Recommended Posts

#include<stdio.h>
#include<math.h>

int sum(int x,int y);
[COLOR="Red"]{[/COLOR](他說這邊錯了!)
switch(user)
{
case 1:
printf("1");
break;
case 2:
break'
case 3:
break;
case 4:
break;
}
return total
}


main()
{
int user;
int num1,num2;
int total;

printf("請輸入兩個數值:");
scanf("%d",&user);

printf("請先選擇功能:(+請按1,-請按2,*請按3,/請按4,次方請按5)");
scanf("%d",&num1);
scanf("%d",&num2);

int sum(int a,int b);
printf("total");

system("pause");
}

到底哪裡錯了?有點急,謝謝

鏈接文章
分享到其他網站


int sum(int x,int y); // Declaration

int sum(int x,int y) // Implementation
{
switch(user)
{
case 1:
printf("1");
break;
case 2:
break'
case 3:
break;
case 4:
break;
}
return total
}

Fixed.

EDIT:

PS:

I suggest getchar() to replace system("pause");

For two reasons:

- Better compatibility ( Works on not only Windows. )

- Faster ( system invokes another process )

鏈接文章
分享到其他網站

請登入後來留意見

在登入之後,您才能留意見



立即登入