C语言编程弱弱的问题。错误:语句缺少';'在 main 函数中

来源:百度知道 编辑:UC知道 时间:2024/05/28 20:23:11
刚开始学C语言,经常遇到怎么调试都不能运行的错误,麻烦各位达人帮忙。
谢谢!
#include<stdio.h>
main()
{
double QT,molecule;

printf("Input the QT of water");
scanf("%lf",&QT);

molecule=QT*950*3.0e-23
printf("The water contain %e molecules.",molecule);
getch();
}
错误 ** 10: 语句缺少';'在 main 函数中
警告 ** 12: 'molecule' 被赋值但却没有使用在 main 函数中
Win-TC下的

23后面缺分号,%e改为%lf 或者再输出前强制转换类型

molecule=QT*950*3.0e-23
这里要加分号; molecule=QT*950*3.0e-23;

#include<stdio.h>
main()
{
double QT,molecule;
molecule=0;
printf("Input the QT of water");
scanf("%lf",&QT);
molecule=QT*950*3.0e-23;
printf("The water contain %e molecules.",molecule);
getch();
}

#include<stdio.h>
main()
{
double QT,molecule;

printf("Input the QT of water");
scanf("%lf",&QT);

molecule=QT*950*3.0e-23;
printf("The water contain %e molecules.",molecule);
getch();
}

molecule=QT*950*3.0e-23
这句后面没有分号

的确没赋值哦。你的输出数没赋值。