main(){
int a;
printf("input integer number: ");
scanf("%d",&a);
switch (a){
case 1:printf("Monday\n");
case 2:printf("Tuesday\n");
case 3:printf("Wednesday\n");
case 4:printf("Thursday\n");
case 5:printf("Friday\n");
case 6:printf("Saturday\n");
case 7:printf("Sunday\n");
default:printf("error\n");
}
C语言报错 C:\Users\Administrator\Desktop\1.c\122102.c In function `main':
14 C:\Users\Administrator\Desktop\1.c\122102.c syntax error at end of input
是什么原因呢
你的程序错误,是在
cout << “Enter the temperature in Celsius:”;
cout << “Fahrenheit value is:”;中用了中文状态下的双引号。
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;
// calculate conversion factor for Celsius
// to Fahrenheit
int factor;
factor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;
// output the results (followed by a NewLine)
cout << "Fahrenheit value is:";
cout << fahrenheit << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
以上程序正确,可以运行。
如果还不行,那就是编译器的问题。建议:用vc2008,c-free或vc2010.微软已停止对vc6.0进行更新了。(开始不习惯很正常,成为高手后会喜欢例如vc2010的)。