|
**.c 하고 **.cpp 하고 다른 가봐여..
똑같은 소스를 c로 저장해서 컴파일 하면 에러가 나고 cpp로 저장하면 에러 없이 잘 돌아가니..
이 소스가 그렇던데.. 왜 그런지..설명좀 부탁해여..
Declaration is not allowed here
Declaration is not allowed here
Declaration is not allowed here
이렇게 에러 코드가 나오네여..
#include <stdio.h>
#include <conio.h>
void main(void)
{
clrscr();
char *name,*num; <----------- 여기서.에러
int kor,eng,math,sci,phy; <------------- 여기서에러
float total1,total2,avg1,avg2; <--------- 여기서 에러
gotoxy(40,5); printf("score");
gotoxy(23,7); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
gotoxy(25,9);
printf("input name : "); scanf("%s",name);
gotoxy(25,10);
printf("input number : "); scanf("%s",num);
gotoxy(16,11);
printf("input First kor, eng, math, sci, phy :");
scanf("%d %d %d %d %d",&kor,&eng,&math,&sci,&phy);
total1=kor+eng+math+sci+phy;
avg1=total1/5;
gotoxy(16,12);
printf("input Second kor, eng, math, sci, phy :");
scanf("%d %d %d %d %d",&kor,&eng,&math,&sci,&phy);
total2=kor+eng+math+sci+phy;
avg2=total2/5;
gotoxy(23,14); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
gotoxy(25,15);
printf("name : %s\t",name); printf("number : %s\n",num);
gotoxy(25,16);
printf("First total : %.0f , average : %.2f",total1,avg1);
gotoxy(25,17);
printf("Second total : %.0f , average : %.2f",total2,avg2);
gotoxy(23,19);
printf("=======================================");
gotoxy(25,21);
printf("total sum : %.0f , average : %.2f",total1+total2,(avg1+avg2)/2);
getch();
}
|