- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
4. Some Tests With switch-case :
A student’s letter grade is calculated according to the following schedule.Write a C program with switch that accepts a students numerical grade.and displays the letter grade.
Numerical grade letter grade
greater than or equal to 90 A
less than 90 but greater than or equal to 80 B
less than 80 but greater than or equal to 70 C
less than 70 but greater than or equal to 60 D
less than 60 E
#includestdio.h
main()
{
int marks,index;
printf(please input a mark\n);
scanf(%d,marks);
index=marks/10;
switch(index)
{
case 10:
case 9:
printf(grade=A\n);
break;
case 8:
printf(grade=B\n);
break;
case 7:
printf(grade=C\n);
break;
case 6:
printf(grade=D\n);
break;
default:
printf(grade=E\n);
break;
}
}
1. Some Tests With if –else :
Write a program to determine whether a input number is greater than 100 and less than 200 and divisible by 7 or not,please print the appropriate message on the screen.
Document the output for your report. You dont have to write all the sections in the report. Just paste the program and its output in a word file.
#includestdio.h
main()
{
int a;
printf(input a number\n);
scanf(%d,a);
if(a100a200a%7==0)
printf(true);
else
printf(false);
}
3. Some Tests With getchar() and putchar:
Write a C program that can convert capital letter to lowercase.Example: input ‘A’,then the screen output ‘a’.
When you are sure your program is working correctly,use it to complete the following table.
uppercase lowercase A F G K R Y #includestdio.h
main()
{
char ch;
printf(please input a char);
ch=getchar();
ch=ch+32;
putchar(ch);
}
1. Some Tests With while :
Write a C program that continuously requests a grade to be entered.If the grade is less than 0 or greater than 100,your program should print an appropri
您可能关注的文档
- 4第二节 互连技术FCB.pdf
- 第八章 材料力学资料.doc
- 第六章 电子文件长期存取技术要求.pptx
- 音频信息的采集及编辑.docx
- 第八章 TCL彩电总线进入方法大全.docx
- 浅谈MRI图像质量控制.docx
- 全国大学生网络安全知识竞赛试题和答案.docx
- 第十三章 计算机组成原理测试题一.docx
- 互联网+新形势下-企业在电子商务经营中所面临过的法律风险和应对措施.docx
- 影响药品储存质量因素.doc
- 2024高考物理一轮复习规范演练7共点力的平衡含解析新人教版.doc
- 高中语文第5课苏轼词两首学案3新人教版必修4.doc
- 2024_2025学年高中英语课时分层作业9Unit3LifeinthefutureSectionⅢⅣ含解析新人教版必修5.doc
- 2024_2025学年新教材高中英语模块素养检测含解析译林版必修第一册.doc
- 2024_2025学年新教材高中英语单元综合检测5含解析外研版选择性必修第一册.doc
- 2024高考政治一轮复习第1单元生活与消费第三课多彩的消费练习含解析新人教版必修1.doc
- 2024_2025学年新教材高中英语WELCOMEUNITSectionⅡReadingandThi.doc
- 2024_2025学年高中历史专题九当今世界政治格局的多极化趋势测评含解析人民版必修1.docx
- 2024高考生物一轮复习第9单元生物与环境第29讲生态系统的结构和功能教案.docx
- 2024_2025学年新教材高中英语UNIT5LANGUAGESAROUNDTHEWORLDSect.doc
文档评论(0)