close

 

台北商業技術學附設空中進修學院

標題:

C語言除錯

發問:

轉學考補習找樂學網#include#includeint sum(int a1,int b1){ int q=0 q=a1+b1; return q;}int sub(int a2,int b2){ int w=0 w=a2-b2; return w;}int times(int a3,int b3){ int e=0 e=a3*b3; return e;}float modd(int a3,int b3 ){ float c4=0; c4=(float)a3/b3 ... 顯示更多 #include #include int sum(int a1,int b1) { int q=0 q=a1+b1; return q; } int sub(int a2,int b2) { int w=0 w=a2-b2; return w; } int times(int a3,int b3) { int e=0 e=a3*b3; return e; } float modd(int a3,int b3 ) { float c4=0; c4=(float)a3/b3 return c4; }int main(void) { float modd(int ,int ); int sum1 ,x,y,z; float sum2; gg: printf("輸入x:"); scanf("%d",&x); printf("輸入y"); scang("%d",&y); printf("輸入選項 加(1) 減(2) 乘(3) 除(4)"); scanf("%d",&z); switch(z) { case 1: sum1=sum(x,y); printf("總和為%d ",suml); brack; case 2: sum1=sub(x,y); printf("差為%d ",suml); brack; case 3: sum1=times(x,y); printf("相乘為%d ",suml); brack; case 4: sum1=modd(x,y); printf("商為%f ",sum2); brack; } printf(" "); goto gg; system("PAUSE"); return 0; } 拜託大家了

最佳解答:

#include #include int sum(int a1,int b1) { int q=0; q=a1+b1; return q; } int sub(int a2,int b2) { int w=0; w=a2-b2; return w; } int times(int a3,int b3) { int e=0; e=a3*b3; return e; } float modd(int a3,int b3 ) { float c4=0; c4=(float)a3/b3; return c4; } int main(void) { float modd(int ,int ); int x,y,z; float sum1; float sum2=0; gg: printf("輸入x:"); scanf("%d",&x); printf("輸入y:"); scanf("%d",&y); //scanf打成scang printf("輸入選項 加(1) 減(2) 乘(3) 除(4) "); scanf("%d",&z); switch(z) { case 1: sum1=sum(x,y); printf("總和為%.f ",sum1); //1打成小寫L break; case 2: sum1=sub(x,y); printf("差為%.f ",sum1); //1打成小寫L break; case 3: sum1=times(x,y); printf("相乘為%.f ",sum1); //1打成小寫L break; case 4: sum2=modd(x,y); printf("商為%.f ",sum2); break; } printf(" "); goto gg; system("PAUSE"); return 0; } ------------------------------------------------------------------------------ 上面幾個函式有幾行最後面都少打分號

其他解答:彰化陳贊民數學補習班

brack; ---> 是 break;

29077F888C89A7E7

arrow
arrow
    創作者介紹

    蔡佳夫謂冤濱豐較 發表在 痞客邦 留言(0) 人氣()