c语言程序设计实例求C语言程序设计实例,要100行以上

c语言程序设计实例  时间:2021-08-24  阅读:()

求c语言程序设计实例80到100行

#include <stdio.h> /*头函数*/ int main(void) /*主函数*/ { char c; /*指定c成为字符变量*/ printf("请输入0到9的任意一个数字 "); /*输出请输入0到9的任意一个数字*/ c=getchar(); /*输入一个字符*/ while(c>=48&&c<=57) /*c的取值范围*/ { getchar(); switch(c) /*根据c的值转换*/ { case '0': printf("你喜欢奋斗吗? "); /*假如c=0,输出你喜欢奋斗吗?*/ break; /*中断跳出,执行c=getchar()*/ case '1': printf("你喜欢当模特吗? "); /*假如c=1,输出你喜欢当模特吗?*/ break; /*中断跳出,执行c=getchar()*/ case '2': printf("你喜欢和谐吗? "); /*假如c=2,输出你喜欢和谐吗?*/ break; /*中断跳出,执行c=getchar()*/ case '3': printf("你喜欢道家吗? "); /*假如c=3,输出你喜欢道家吗?*/ break; /*中断跳出,执行c=getchar()*/ case '4': printf("你是广东人吗? "); /*假如c=4,输出你是广东人吗?*/ break; /*中断跳出,执行c=getchar()*/ case '5': printf("你喜欢武术吗? "); /*假如c=5,输出你喜欢武术吗?*/ break; /*中断跳出,执行c=getchar()*/ case '6': printf("祝你一帆风顺! "); /*假如c=6,输出祝你一帆风顺!*/ break; /*中断跳出,执行c=getchar()*/ case '7': printf("观察等待好机会! "); /*假如c=7,输出观察等待好机会!*/ break; /*中断跳出,执行c=getchar()*/ case '8': printf("你喜欢交际吗? "); /*假如c=8,输出你喜欢交际吗?*/ break; /*中断跳出,执行c=getchar()*/ case '9': printf("追求完美吧! "); /*假如c=9,输出追求完美吧!*/ break; /*中断跳出,执行c=getchar()*/ } c=getchar(); /*再输入一个字符*/ } return 0; /*返回值*/ }

c语言程序设计案例。要100行左右的。。核心代码50行左右,可以在TC上运行的。拜谢了,,,

下面是个C++代码。

估计你会用上,呵呵。

~!~ #include "stdio.h" #include "stdlib.h" class Student { public: int id; int eng; int math; puter; double avg; double total; Student(){id=-1;eng=-1;;math=puter=-1;avg=-1;total=-1;}; double Aveage() { return avg=(double)(eng+puter)/(double)3; }; double Sum() { return total=(double)(eng+puter); }; }; void EX(Student*A,Student*B)//排序 { Student temp; temp=*A; *A=*B; *B=temp; } void PX(Student* A,int s) { Student* R=new Student[s]; for(int i=0;i<s;i++) { for(int j=i+1;j<s;j++) { if((A+i)->avg<(A+j)->avg) EX(A+i,A+j); } } }; void main() { int s=-1; printf("请输入学生个数 "); scanf("%d",&s); Student *all=new Student[s]; printf("eng,puter "); for(int i=0;i<s;i++) { scanf("%d %d %d",&(all+i)->eng,&(all+i)->math,&(all+i)-&puter);//输入以空格为间隔以回车为确定 (all+i)->Aveage();(all+i)->Sum();(all+i)->id=i+1; } PX(all,s); printf("ID,eng,puter,avg,total "); for(int j=0;j<s;j++) { printf("%d,%d,%d,%d,%2.2f,%d ",(all+j)->id,(all+j)->eng,(all+j)->math,(all+j)-&puter,(all+j)->avg,(all+j)->total); } }

c语言编程实例

#include<stdio.h> int main(void) { int i,j; for(i = 1;i <=4;i++) { for(j = 1;j <= i;j++) printf("%d",j); printf(" "); } printf(" "); return 0; } 这是最简单的,可以有附加功能。

求C语言程序设计实例,要100行以上

Problem Description: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will , in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each .

For a given request list, you are pute the total time spent to fulfill the requests on the list. The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.

Input: There are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N = 0 denotes the end of input. This test case is not to be processed.

Output Print the total time on a single line for each test case.

Sample Input 1 2 3 2 3 1 0

Sample Output 17 41

Here is my code:

#include<stdio.h> int time(int a,int b) { if(a==b)return 0; else if(a<b) return (b-a)*6; else return (a-b)*4; } int main() { int n,start,end,ans; while(1) { scanf("%d",&n); if(n==0)break; start=0;ans=0; while(n--) { scanf("%d",&end); ans+=time(start,end)+5; start=end; } printf("%d ",ans); } return 0; } 说明:程序代码的多少不是评价一个程序质量的唯一标准。

#推荐# cmivps:全场7折,香港不限流量VPS,支持Windows系统

cmivps香港VPS带来了3个新消息:(1)双向流量改为单向流量,相当于流量间接扩大一倍;(2)Hong Kong 2T、Hong Kong 3T、Hong Kong 无限流量,这三款VPS开始支持Windows系统,如果需要中文版Windows系统请下单付款完成之后发ticket要求官方更改即可;(3)全场7折年付、8折月付优惠,优惠码有效期一个月!官方网站:https://www.cmivp...

易探云香港vps主机价格多少钱?香港云服务器主机租用价格

易探云香港vps主机价格多少钱?香港vps主机租用费用大体上是由配置决定的,我们选择香港vps主机租用最大的优势是免备案vps。但是,每家服务商的机房、配置、定价也不同。我们以最基础配置为标准,综合比对各大香港vps主机供应商的价格,即可选到高性能、价格适中的香港vps主机。通常1核CPU、1G内存、2Mbps独享带宽,价格在30元-120元/月。不过,易探云香港vps主机推出四个机房的优惠活动,...

傲游主机38.4元起,韩国CN2/荷兰VPS全场8折vps香港高防

傲游主机怎么样?傲游主机是一家成立于2010年的老牌国外VPS服务商,在澳大利亚及美国均注册公司,是由在澳洲留学的害羞哥、主机论坛知名版主组长等大佬创建,拥有多家海外直连线路机房资源,提供基于VPS主机和独立服务器租用等,其中VPS基于KVM或者XEN架构,可选机房包括中国香港、美国洛杉矶、韩国、日本、德国、荷兰等,均为CN2或者国内直连优秀线路。傲游主机提供8折优惠码:haixiuge,适用于全...

c语言程序设计实例为你推荐
表单控件在网页中创建一个表单,表单中包含各种表单控件,利用表格对各个控件以及输入提示文字进行布局权限表什么是DRM权限列表,怎么使用高级工程师证书查询如何查工程师证化学键理论现代化学键理论认为苯环结构中不存在单双键交替结构,可以作为证据的事实是①苯不能使酸性KMnO 4 溶液褪无线存储手机wifi无线摄像头可以储存吗网络黑科技什么防封软件,都是假的,没有一个是真的,大家不要受骗!呼叫中心系统方案哪些呼叫中心厂商在呼叫中心系统方案建设方面好?什么是无线上网WIFI无线网络是什么网络?access数据库入门access的用法?公司注册如何办理怎么才能注册公司?
域名是什么 网通vps linuxvps 荷兰服务器 arvixe cve-2014-6271 java主机 域名优惠码 监控宝 创宇云 12306抢票助手 网站被封 圣诞促销 怎么测试下载速度 admit的用法 200g硬盘 老左来了 爱奇艺vip免费试用7天 福建铁通 免费phpmysql空间 更多