代码:
#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'发布于 2019-09-23 23:13:38
您的两个printf()命令:
printf("%d",c,\n);和
printf("%d",c \n);缺少换行符周围的引号(和一个逗号)。它们应该看起来像这样:
printf("%d \n",c);https://stackoverflow.com/questions/58066177
复制相似问题