編寫(xiě)程序?qū)崿F(xiàn)自然數(shù)的基本運(yùn)算?
#include"stdio.h"#include"stdlib.h"#include"math.h"
12void main(){int jisuan(int x, int y);int N, M;printf("輸入兩個(gè)數(shù)字:\n");scanf_s("%d %d",&M,&N);
此處沒(méi)有調(diào)用方法,只有輸入函數(shù)!!
要表達(dá)???
}
這部分沒(méi)做聲明,而且算法我沒(méi)看,int jisuan(int x, int y){int Z, C;printf("輸入想進(jìn)行的運(yùn)算輸入相應(yīng)的數(shù)字:(加法=1減法=2乘法=3除法=4)\n");scanf_s("%d", &C);if (C == 1)Z = x + y; scanf_s("%d", &Z);if (C == 2)Z = x - y; scanf_s("%d", &Z);if (C == 3)Z = x * y; scanf_s("%d", &Z);if (C == 4 && y == 0)printf("ERROR!");else Z = x / y; scanf_s("%d", &Z);printf("%d %d %d", &x, &y, &Z);return 0;}