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

Budgetvm12核心 16G 500 GB SSD 或者 2 TB SATA 10GB  20 TB  99美金

Budgetvm(原EZ机房),2005年成立的美国老品牌机房,主打美国4个机房(洛杉矶、芝加哥、达拉斯、迈阿密)和日本东京机房的独立服务器和VPS业务,而且不限制流量,默认提供免费的1800G DDoS防御服务,支持IPv6和IPMI,多种免费中文操作系统可供选择,独立服务器主打大硬盘,多硬盘,大内存,用户可以在后台自行安装系统等管理操作!内存可定制升级到1536G,多块硬盘随时加,14TBSA...

QQ防红跳转短网址生成网站源码(91she完整源码)

使用此源码可以生成QQ自动跳转到浏览器的短链接,无视QQ报毒,任意网址均可生成。新版特色:全新界面,网站背景图采用Bing随机壁纸支持生成多种短链接兼容电脑和手机页面生成网址记录功能,域名黑名单功能网站后台可管理数据安装说明:由于此版本增加了记录和黑名单功能,所以用到了数据库。安装方法为修改config.php里面的数据库信息,导入install.sql到数据库。...

Hostodo商家提供两年大流量美国VPS主机 可选拉斯维加斯和迈阿密

Hostodo商家算是一个比较小众且运营比较久的服务商,而且还是率先硬盘更换成NVMe阵列的,目前有提供拉斯维加斯和迈阿密两个机房。看到商家这两年的促销套餐方案变化还是比较大的,每个月一般有这么两次的促销方案推送,可见商家也在想着提高一些客户量。毕竟即便再老的服务商,你不走出来让大家知道,迟早会落寞。目前,Hostodo有提供两款大流量的VPS主机促销,机房可选拉斯维加斯和迈阿密两个数据中心,且都...

c语言程序设计实例为你推荐
卖源码淘宝上卖源码可以退货吗???制作证书怎么做证书?网不易上网的利与弊(辩论)监控设备安装监控设备如何安装高级工程师证书查询如何查工程师证价格咨询造价咨询公司收费标准是按公司给还是按个人给?网通玩电信游戏卡怎么办玩英雄联盟家里是网通的,玩电信区很卡怎么办等保测评机构什么是三级等保体系 three-levelqq空间播放器代码qq空间最新播放器代码阿里学院首页在阿里学院必须实名认证吗
泛域名解析 域名解析文件 腾讯云盘 openv 256m内存 nerd 好玩的桌面 如何注册阿里云邮箱 监控服务器 什么是web服务器 免费网络 深圳域名 googlevoice register.com webmin 卡巴斯基免费下载 热云 六维空间登陆首页 好看的空间头像 网购分享吧 更多