无法理解使用 Turbo C 的 C 语言错误的含义。我编写了这段代码

Unable to understand the meaning of errors in C language using Turbo C. I've coded this code

这就是我编写的代码 - 使用 turbo c 在 c 语言中交换 2 个数字。我已经非常努力地 google 解决方案,但由于我只是一个初学者,因此无法理解解释。我将在 20 号进行内部检查,这是他们可能会与其他 40 个程序一起询问的问题......

你应该写 printf("please enter"); 而不是 printf{"please enter"};scanf 相同。 当您看到 Statement missing ; 错误时,您肯定有语言错误。

函数采用 (){} 之间的参数用于代码块。例如:

if (1) {
    printf("Printing\n");
    printf("Printing again\n");
}

另一件事是,我们将值分配给 = 的左侧。

a = a-b
a = a+b

您的代码应该是:

#include<stdio.h>
void main() {
    int a,b;
    printf("Enter two (2) numbers, please\n");
    scanf("%d%d", &a, &b);
    a = a+b;    //assign a to the sum of current a and b
    b = a-b;
    a = a-b;
    printf("The numbers a, b after some calculations are: a=%d and b=%d\n", a, b);
}

在函数中使用圆括号 () 而不是大括号 {} printf() , scanf().

printf("please enter 2 nos");
scanf("%d %d" &a,&b);


printf("our exchanged numbers are a = %d" and b=%d" a,b);

而且你不能给表达式赋值,它会给出 lvalue 错误。因此,要删除此错误更改, a-b = a 改成 a=a-b 并改变所有的表达式。