Write a C program that asks for your full name (e.g.Oliver Twist),followed by your student ID numWrite a C program that asks for your full name (e.g.Oliver Twist),followed by yourstudent ID number (e.g.8888888) and then prints your full name and stud

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 17:28:39
WriteaCprogramthatasksforyourfullname(e.g.OliverTwist),followedbyyourstudentIDnumWriteaCprogramthata

Write a C program that asks for your full name (e.g.Oliver Twist),followed by your student ID numWrite a C program that asks for your full name (e.g.Oliver Twist),followed by yourstudent ID number (e.g.8888888) and then prints your full name and stud
Write a C program that asks for your full name (e.g.Oliver Twist),followed by your student ID num
Write a C program that asks for your full name (e.g.Oliver Twist),followed by your
student ID number (e.g.8888888) and then prints your full name and student ID number
in the following format:
Your name is:Oliver Twist.
Your student ID is:8888888.
以下是我编的程序
void main()
{
char name[40];
number[40];
printf("What is your full name?\n");
scanf("%s",name);
printf("What is your student ID number?\n" );
scanf("%s",number);
printf("Your full name is:%s\n,Your student ID:%s",name,number);
为啥电脑不能运行?

Write a C program that asks for your full name (e.g.Oliver Twist),followed by your student ID numWrite a C program that asks for your full name (e.g.Oliver Twist),followed by yourstudent ID number (e.g.8888888) and then prints your full name and stud
number 输出的是 %d 是数字 而s 代表的字母
还有一点就是scanf函数 输入时必须是这样的
scanf("%s",&number);
&必不可少!
你也是西利的不?
你还交作业了?那个 我今天看课件 才发现 其实 name的那个 输入不应该用scanf 应该用gets 这样就可以输入 Oliver Twist中间的空格了!