2017年10月5日

20151017练习自定义函数调用

摘要: #include #include int sayLove(){ printf("%s\n", "I Love China"); return 0;}int dividLine(){ printf("%s\n", "*************"); return 0;}int... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(93) 评论(0) 推荐(0)

20151017数组计算学生考试成绩

摘要: /*在一个长度为10的整型数组里面,保存了班级10个学生的考试成绩。要求编写5个函数,分别实现计算考试的总分,最高分,最低分,平均分和考试成绩降序排序。*/#include #include #define N 10//打印分数 void printScore(int score[]){ int i... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(183) 评论(0) 推荐(0)

20151017计算出租车打车费用

摘要: /*北京市出租车打车计费规则如下:1. 每公里单价计费2.3元2. 起步价13元(包含3公里)3. 晚上23点(含)至次日凌晨5点(不含)打车,每公里单价计费加收20%。4. 每次乘车加收1元钱的燃油附加税。小明每天上下班都要打车回家,公司和家的距离为12公里,上午上班时间为9点,下午下班时间为6点... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(312) 评论(0) 推荐(0)

20151017高斯求和,比较大小

摘要: 一,高斯求和:#include #include int main(){ int i,sum=0; i=1; while( i#include#includeint main(){int a,b,t;printf("请输入两个数:a,b:");scanf("%d,%d",&a,&... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(115) 评论(0) 推荐(0)

20151015计算阶乘

摘要: #include #include int factorial(int n) { int result; if(n<0) { printf("输入错误!\n"); return 0; } else if(n==0||... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(77) 评论(0) 推荐(0)

20151015企业招工与县城工业产值增长率问题

摘要: 这两个问题本质上属于同一种算法。一,企业招工增长率问题: /*某公司2015年在职人数为200人,以每年20%增长速度不断扩大招工规模,请使用do-while循环计算从2015开始至哪一年招工规模能够突破1000人。*/#include #include int main(){ int num... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(145) 评论(0) 推荐(0)

20151015查找水仙花数

摘要: /*设计一个程序,找出100~999内所有的"水仙花数"."水仙花数"的定义是:三位数的各位数字立方和等于这个三位数本身,例如153=1*1*1+5*5*5+3*3*3.*/#include #include int main(){ //定义三位数num,个位数sd,十位数td,百位数hd ... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(136) 评论(0) 推荐(0)

20151015查找素数

摘要: #include #include int main(){ int m, n,num; printf("输入查找范围:从1到");scanf("%d",&num); for(m=2; m<=num; m++) {for(n=2; n<=m; n++) { ... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(101) 评论(0) 推荐(0)

20151014星号三角阵(四种)

摘要: 一,右上三角:#include#includeint main(){int i,j;for(i=1;i=1;j--)printf("*");printf("\n");}system("pause");}二,右下三角:#include#includeint main(){int i,j;for(i=1... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(255) 评论(0) 推荐(0)

20151014静态、动态心形图

摘要: 一,静态小图:#include #include int main() { float x,y,z,f; for(y=1.5f;y>-1.5f;y=(y-0.1f)) { for(x=-1.5f;x#include #include float f(float x, f... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(250) 评论(0) 推荐(0)

20150910九九乘法表

摘要: #include"stdio.h"#include"conio.h"int main(){int x,y,z;for(y=1;y<=9;y++){ for(x=1;x<=y;x++){ z=x*y; printf("%d×%d=%d,",x,y,z);}printf("\n")... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(81) 评论(0) 推荐(0)

20150721输入大小写,输出小大写

摘要: #includeusing namespace std;int main(){char c;do{c=getchar();if(c>=65&&c=97&&c=32&&c90&&c122&&c<=127)//亮点在于怎样取消cmd窗口的行首空格putchar(32);else ;}}while(c!=... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(161) 评论(0) 推荐(0)

20150721输入年号,判断干支纪年和生肖

摘要: #includeusing namespace std;int main(){int a,b,c,year;cout>year;cout10)a=(a-10);c=b=(year%12+9);if(b>12)c=b=(b-12);cout<<"您输入的年号是";switch(a){case 1:c... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(151) 评论(0) 推荐(0)

GetSystemTimes函数实验(动态获得CPU占用率和CPU闲置率)

摘要: #include #include #include using namespace std;int CompareFileTime(FILETIME time1, FILETIME time2){ int a = time1.dwHighDateTime #include #include usi... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(1187) 评论(0) 推荐(0)

GetSystemInfo函数实验

摘要: #include #include #include using namespace std;int main(){ SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); cout << left << setw(20) << "CPU分页大小:" ... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(147) 评论(0) 推荐(0)

MOOC清华《面向对象程序设计》第4章:函数模板实验

摘要: #include using namespace std;template T sum(T a, T b){ return a + b;}int main(){ int a = 3, b = 4; cout using namespace std;template T0 func(T1 v1, T2... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(104) 评论(0) 推荐(0)

book1 unit1 after-class reading 2 : We All Need Friends

摘要: Having good old friends is a good thing, but making new ones can be even better. No matter what age we are, all of us appreciate the support and help ... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(323) 评论(0) 推荐(0)

book1 unit1 after-class reading 1 : Love Thy Neighbor

摘要: It seems to me that neighbors are going out of style in America. The friend next door from whom you borrowed four eggs or a ladder has moved, and the ... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(228) 评论(0) 推荐(0)

book1 unit1 in-class reading : The Gift of Life

摘要: The bombs landed in the small village.Nobody knows what these bombs were supposed to hit during the terrible Vietnam War,but they landed in a small or... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(472) 评论(0) 推荐(0)

MOOC清华《面向对象程序设计》第4章:强制类型转换实验

摘要: #include using namespace std;class B{public: virtual void f() {}};class D : public B{};class E{};int main(){ D d1; B b1; //d1 = static_cast(b1);//ERRO... 阅读全文

posted @ 2017-10-05 18:17 sunshineman1986 阅读(113) 评论(0) 推荐(0)

导航