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

[6.18]DogYun:充100送10元,态云7折,经典云8折,独立服务器月省100元,幸运大转盘最高5折

DogYun是一家2019年成立的国人主机商,提供VPS和独立服务器租用等,数据中心包括中国香港、美国洛杉矶、日本、韩国、德国、荷兰等,其中VPS包括常规VPS(经典云)和按小时计费VPS(动态云),使用自行开发的面板和管理系统,支持自定义配置,动态云各个硬件独立按小时计费,带宽按照用户使用量计费(不使用不计费)或者购买流量包,线路也可以自行切换。目前商家发布了6.18促销方案,新购动态云7折,经...

MOACK:韩国服务器/双E5-2450L/8GB内存/1T硬盘/10M不限流量,$59.00/月

Moack怎么样?Moack(蘑菇主机)是一家成立于2016年的商家,据说是国人和韩国合资开办的主机商家,目前主要销售独立服务器,机房位于韩国MOACK机房,网络接入了kt/lg/kinx三条线路,目前到中国大陆的速度非常好,国内Ping值平均在45MS左右,而且商家的套餐比较便宜,针对国人有很多活动。不过目前如果购买机器如需现场处理,由于COVID-19越来越严重,MOACK办公楼里的人也被感染...

CheapWindowsVPS:7个机房可选全场5折,1Gbps不限流量每月4.5美元

CheapWindowsVPS是一家成立于2007年的老牌国外主机商,顾名思义,一个提供便宜的Windows系统VPS主机(同样也支持安装Linux系列的哈)的商家,可选数据中心包括美国洛杉矶、达拉斯、芝加哥、纽约、英国伦敦、法国、新加坡等等,目前商家针对VPS主机推出5折优惠码,优惠后最低4GB内存套餐月付仅4.5美元。下面列出几款VPS主机配置信息。CPU:2cores内存:4GB硬盘:60G...

c语言程序设计实例为你推荐
文本分析如何解读文本移动开发什么是android移动应用开发好享购物我国省级电视台有哪些化学键理论化学键的定义封包是什么游戏开挂是什么意思?锤子手机发布会视频锤子手机怎么开机的相关视频垂直型网站水平型、垂直型、综合型电子商务网站的主要特征是什么?网站建设的内容企业网站建设一般包含了哪些内容?安全管家安全管家和QQ手机管家哪个好用?镜像什么叫做镜像?镜像文件有什么用?
便宜域名 Vultr 网络星期一 监控宝 京东云擎 服务器怎么绑定域名 空间论坛 gspeed 免费个人空间 isp服务商 网络空间租赁 爱奇艺vip免费试用7天 广州服务器 论坛主机 德讯 网络速度 hdsky 沈阳idc 建站技术 此网页包含的内容将不使用安全的https 更多