代码:
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("addition of two numbers\n");
scanf("%d%d",&a,&b);
c = a + b;
printf("%d",c,\n);
printf("subtraction of two numbers\n");
scanf("%d%d",&a,&b);
c = a - b;
printf("%d",c \n);
return 0;
}
错误:
9 2 C:\Users\Yash\Documents\c.3.cpp [Error] stray '\' in program
13 2 C:\Users\Yash\Documents\c.3.cpp [Error] stray '\' in program
C:\Users\Yash\Documents\c.3.cpp In function 'int main()':
9 17 C:\Users\Yash\Documents\c.3.cpp [Error] 'n' was not declared in this scope
13 17 C:\Users\Yash\Documents\c.3.cpp [Error] expected ')' before 'n'
答案 0 :(得分:-1)
您的两个printf()
命令:
printf("%d",c,\n);
和
printf("%d",c \n);
在换行符周围缺少引号(一个逗号)。他们应该看起来像这样:
printf("%d \n",c);