C语言编译
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C语言编译相关的知识,希望对你有一定的参考价值。
求高手帮忙!!!谢谢了~
该程序要求用户输入个人信息,然后打印出来一段欢迎的话。程序的运行要求达到如下示例的效果:
Please input your name:
Tom
Please input your class:
F06032032
How many students in your class?
30
Hello, Tom! Welcome to SJTU! You are in class F06032032. You have 29 classmates.
main()
char name,class;
int num;
printf("Please input your name:\n");
scanf("%name\n",&name);
printf("Please input your class:\n");
scanf("%class\n",&class);
printf("How many students in your class?\n");
scanf("%num\n",&num);
printf("Hello, ");
printf("name!",name);
printf(" Welcome to SJTU! You are in class");
printf("class",class);
printf(".You have");
printf("num-1",num);
printf(" classmates.");
参考技术B #include<stdio.h>
void main()
char name[10],cl[20];
int cMates=0;
printf("Please input your name:\n");
scanf("%s",name);
printf("Please input your class:\n");
scanf("%s",cl);
printf("How many students in your class?\n");
scanf("%d",&cMates);
printf("Hello, %s! Welcome to SJTU! You are in class %s. You have %d classmates.\n",name,cl,cMates-1);
本回答被提问者采纳 参考技术C #include<stdio.h>
void main()
char name[20];
char Class[20];
int number;
printf("Please input your name:\n ");
scanf("%s",&name);
printf("Please input your class: \n");
scanf("%s",&Class);
printf("How many students in your class?\n");
scanf("%d",&number);
printf("\n");
printf("Hello, %s! Welcome to SJTU! You are in class %s. You have %d classmates",name,Class,number-1);
参考技术D //---------------------------------------------------------------------------
#include <stdio.h>
int main(void)
char name[50],clas[80];
int ns ;
puts("Please input your name: ");
gets(name);
puts("Please input your class: ");
gets(clas);
puts("How many students in your class? ");
scanf("%d",&ns);
printf("Hello, %s! Welcome to SJTU! You are in class %s. You have %d classmates.\n",name,clas,ns-1);
return 0;
//--------------------------------------------------------------------------- 第5个回答 2008-03-30 前面的两个程序都差不多,就是第三个程序不怎么样。但是第三个程序对于刚开始学的人还是不错的。我建议采纳第一个程序。
C语言编译出现了 多重定义的符号 的报错
C语言编译出现了 多重定义的符号 的报错怎么办 谢谢详细回答
同一个工程中创建了多个main函数关闭当前工程,另建一个工程后重新编译 参考技术A 第二命令错了,返回0是个什么鬼。应该是这个return;
以上是关于C语言编译的主要内容,如果未能解决你的问题,请参考以下文章