C语言报错的问题?

main(){inta;printf("inputintegernumber:");scanf("%d",&a);switch(a){case1:printf("Mond... 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
是什么原因呢
展开
 我来答
wujt99
2018-01-09 · TA获得超过2.6万个赞
知道小有建树答主
回答量:159
采纳率:94%
帮助的人:4.1万
展开全部

你的程序错误,是在
cout << “Enter the temperature in Celsius:”;
cout << “Fahrenheit value is:”;中用了中文状态下的双引号。

  1. #include <cstdio>

  2. #include <cstdlib>

  3. #include <iostream>

  4. using namespace std;

  5. int main(int nNumberofArgs, char* pszArgs[])

  6. {

  7. // enter the temperature in Celsius

  8. int celsius;

  9. cout << "Enter the temperature in Celsius:";

  10. cin >> celsius;

  11. // calculate conversion factor for Celsius

  12. // to Fahrenheit

  13. int factor;

  14. factor = 212 - 32;

  15. // use conversion factor to convert Celsius

  16. // into Fahrenheit values

  17. int fahrenheit;

  18. fahrenheit = factor * celsius/100 + 32;

  19. // output the results (followed by a NewLine)

  20. cout << "Fahrenheit value is:";

  21. cout << fahrenheit << endl;

  22. // wait until user is ready before terminating program

  23. // to allow the user to see the program results

  24. system("PAUSE");

  25. return 0;

  26. }

以上程序正确,可以运行。

如果还不行,那就是编译器的问题。建议:用vc2008,c-free或vc2010.微软已停止对vc6.0进行更新了。(开始不习惯很正常,成为高手后会喜欢例如vc2010的)。

本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
我喂卡
2021-01-15
知道答主
回答量:32
采纳率:0%
帮助的人:5535
展开全部
#include <stdio.h>
#include <string.h>
int main()
{

int gg(int i);
int i;
while(1){
i=0;
printf(" 1.查看历史日程表\n");
printf(" 2.输入新的日程表\n");
printf(" 3.查看已完成的日程表\n");
printf(" 4.查看未完成的日程表\n");
printf(" 5.退出登录\n");
printf(" 请选择相应序号: ");
scanf("%d",&i);
if(i==5){
break;
}
gg(i);
printf("\n");
printf("\n");
printf("\n");
}
}
int gg(int i){
int aa();
int bb();
int cc();
int dd();

switch(i){
case 1:
aa();break;
case 2:
bb();break;
case 3:
cc();break;
case 4:
dd();break;
}
}
int aa(){
FILE*fp;
int length=1000;
char str[1001];
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件");
return 0;
}
while(fgets(str,length,fp)!=NULL){
printf("%s",str);}
return 1;

fclose(fp);
}
int bb(){
FILE*fp;
char str[400];
printf("内容如下:\n");
scanf("%s",str);
if((fp=fopen("11s.txt","a+"))==NULL){
printf("文件不存在");
return 0;
}

fputs("\n",fp);
fputs(str,fp);
printf("加入成功");
fclose(fp);
return 1;
}
int cc(){
FILE*fp;
int length=1000;
char str[1001];
printf("内容如下:\n");
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件");
return 0;
}
while(fgets(str,length,fp)!=NULL){
if(strstr(str,"已完成")!=NULL){
printf("%s",str);
}
}
fclose(fp);
return 1;
}
int dd(){
FILE*fp;
int lenght=1000;
char str[1001];
printf("内容如下:\n");
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件");
return 0;
}
while(fgets(str,lenght,fp)!=NULL){
if(strstr(str,"未完成")!=NULL){
printf("%s",str);
}
}
fclose(fp);
return 1;
}
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式