int score[][] 는 2차 배열입니다. score[] 요렇게만 엑세스 한건 모두 Lvalue requre나 Illefal use of pointer에러가 납니다.
main 함수에 대한 워닝은 Return 값이 없는데 int로 선언 했다는 것입니다.
그럼 수고 하세요.
Ruka 님이 쓰신 글 :
: cygwin에서 작업했습니다.
:
:
: /*
: 1. 배열이 있어야하고
: 2. 입력로 배열에 하나씩 채운다
: 3. 조건을 달아 1~99값이 들어가며 그 외 값은 탈출
: 4. 최대 들어가는 갯수는 100개이다 -> 100개 입력되면 입력종료후 자동실행
:
: - 배열은 1개만 사용하라
:
: 5. 배열에 들어간 모든 값을 계산해서 10단위로 정렬한다
: */
:
: #include <stdio.h>
:
: ●int main()
: {
: int score[2][100]={{0},{0}}; //담는배열
: int person; //갯수 체크 변수
: int i,j,k=0; //보조변수
: int p,q,r=0; //빈공간
:
: printf("~~~~~\n"); //프로그램인트로덕션
:
: ///////////////////////////////////////////////////////////////////////////////////////
:
:
: while(j != 100) //입력횟수 100번이면 루프종료
: {
: i=0;
: scanf("%d",&score[0][i]); //배열에 넣기
: i++;
: person++; //갯수증가
: j++; //횟수증가
: if (score[i]<0 || score[i]>99) //입력값이 99초과조건
: j=100; //횟수를 올려 루프탈출
: }
:
: ///////////////////////////////////////////////////////////////////////////////////////
:
: printf("입력된 데이터 <%d개> : ", person); //입력된 데이터갯수출력
:
: for (k=0; k<person; k++)
: {
: printf("&d " , score[0][i]); //배열값 하나씩 출력
: }
: printf("\n");
: ///////////////////////////////////////////////////////////////////////////////////////
:
: printf("정렬된 데이터 <%d개> : ", person); //정렬된 데이터갯수 출력
:
: for (i=0; i<person ;i++ )
: {
: p=score[0][i];
: q=i-1;
: while (q >=0 && score[0][q] > p)
: {
: score[0][q+1]=score[0][q];
: q--;
:
: }
:
: ● score[q] = p;
:
: }
: for(k=0;k<person;k++)
: printf("%d ", score[0][i]);
:
: printf("\n");
:
: ////////////////////////////////////////////////////////////////////////////////////////
:
: printf("발생빈도수 \n");
:
: for (i=0;i<100 ;i++ )
: {
: r=0;
: ● r=score[i]/10;
: score[1][r]++; //score값을 10으로 나눠 10단위로 카운트 증가
: }
:
: printf(" 0 ~ 9 : %d", score[1][0]);
: printf("10 ~ 19 : %d", score[1][1]);
: printf("20 ~ 29 : %d", score[1][2]);
: printf("30 ~ 39 : %d", score[1][3]);
: printf("40 ~ 49 : %d", score[1][4]);
: printf("50 ~ 59 : %d", score[1][5]);
: printf("60 ~ 69 : %d", score[1][6]);
: printf("70 ~ 79 : %d", score[1][7]);
: printf("80 ~ 89 : %d", score[1][8]);
: printf("90 ~ 99 : %d", score[1][9]);
:
: ●}
:
:
:
: Error message :
: : In Function 'main' :
: 37: warning : comparison between pointer and integer
: 65: error : incompatible types in assignment
: 80: error : invalid operands to binary /
: 95:2: warning : no newline at end of file
:
: 에러메시지가 나있는 줄은 ● 표시했습니당
|