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; } 说明:程序代码的多少不是评价一个程序质量的唯一标准。

RAKsmart含站群服务器/10G带宽不限流量首月半价

RAKsmart 商家估摸着前段时间服务器囤货较多,这两个月的促销活动好像有点针对独立服务器。前面才整理到七月份的服务器活动在有一些配置上比上个月折扣力度是大很多,而且今天看到再来部分的服务器首月半价,一般这样的促销有可能是商家库存充裕。比如近期有一些服务商挖矿服务器销售不好,也都会采用这些策略,就好比电脑硬件最近也有下降。不管如何,我们选择服务器或者VPS主机要本着符合自己需求,如果业务不需要,...

IMIDC(rainbow cloud):香港/台湾/日本/莫斯科独立服务器特价,闪购大促销,最低30usd/月起

imidc怎么样?imidc彩虹网路,rainbow cloud知名服务器提供商。自营多地区数据中心,是 Apnic RIPE Afrinic Arin 认证服务商。拥有丰富的网路资源。 在2021年 6.18 开启了输血大促销,促销区域包括 香港 台湾 日本 莫斯科 等地促销机型为 E3係,参与促销地区有 香港 日本 台湾 莫斯科 等地, 限量50台,售罄为止,先到先得。所有服务器配置 CPU ...

舍利云:海外云服务器,6核16G超大带宽vps;支持全球范围,原价516,折后价200元/月!

舍利云怎么样?舍利云推出了6核16G超大带宽316G高性能SSD和CPU,支持全球范围,原价516,折后价200元一月。原价80美元,现价30美元,支持地区:日本,新加坡,荷兰,法国,英国,澳大利亚,加拿大,韩国,美国纽约,美国硅谷,美国洛杉矶,美国亚特兰大,美国迈阿密州,美国西雅图,美国芝加哥,美国达拉斯。舍利云是vps云服务器的销售商家,其产品主要的特色是适合seo和建站,性价比方面非常不错,...

c语言程序设计实例为你推荐
怎么发邮件怎样发送邮件?权限表帮忙设计个用户权限表提升网站排名如何提高门户网站排名制作证书用excel如何制作证书模板现在网现在网上到处都是招聘带车司机的工作是真的吗?混乱模式拳皇2002的李梅怎么进入混乱模式?背投广告搜狐一个广告费用是多少支付宝安全证书下载怎么下载支付宝安装控件上海网络维护公司上海博好网络科技有限公司的介绍网络黑科技华为有哪些黑科技?
info域名注册 主机域名 谷歌域名邮箱 vps.net 蜗牛魔方 申请个人网站 建立邮箱 网站cdn加速 免费全能主机 绍兴电信 流媒体加速 上海联通宽带测速 linode支付宝 中国域名 xuni 广州主机托管 新疆服务器 美国主机侦探 e-mail windowsserver2012 更多