自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(77)
  • 收藏
  • 关注

原创 请你编写一个统计《C++程序设计》课程的成绩。统计的内容包括最高分、最低分、平均分,以及在90100,80 89,70 79,60 69和60以下个分数段的人数

#include using namespace std;int main(){ int num;//全班人数 int i; cout<<"请输入班级人数:"<<endl; cin>>num; int score[num];//全班成绩 cout<<"请输入全班成绩:"<<endl; for(i=0;i<nu

2013-09-04 09:06:13 5188 1

原创 一球从M米高度自由下落,每次落地后返回原高度的一半,再落下。它在第N次落地时反弹多高?共经过多少米?保留两位小数

#include #include using namespace std;int main(){ int i,t; float m,n,sum=0; cin>>m>>n; t=m; for(i=1;i<=n;i++) { sum=sum+2*m; m=m/2; }

2013-05-15 14:49:54 5197

原创 求方程 的根,用三个函数分别求当b^2-4ac大于0、等于0、和小于0时的根,并输出结果。从主函数输入a、b、c的值。

#include #include #include using namespace std;float x1,x2,disc,p,q;int main(){ void greater_than_zero(float,float); void equal_than_zero(float,float); void smaller_than

2013-05-14 11:40:53 10862 2

原创 两个乒乓球队进行比赛,各出三人。甲队为A,B,C三人,乙队为X,Y,Z三人。但A不与X比,C不与X,Z比。请编出名单

#include using namespace std;int main(){ char i,j,k; for(i='X';i<='Z';i++) for(j='X';j<='Z';j++) if(i!=j) for(k='X';k<='Z';k++) if(i!=k&&j!=k) if(i!='X'&&k

2013-05-14 10:44:57 3687

原创 看过去

今天确实不知要说什么了,呵呵,心里难受的很。没想到因为这么一个小小的过失,让自己觉得自己这么难堪。想要说些什么呢,又不能怪朋友,毕竟有些友谊来之不易。   考虑再三,还是要说一说的,希望大家不要和我一样犯同样的过错。也要珍惜自己的朋友。    事情是这样的。自己参加了一场比赛嘛,主动邀了两个同学,一个不算是太熟吧,本来没想邀他的,阴差阳错吧,发错了短信,但他又答应了,我不好拒绝了,就答应了

2013-05-13 17:15:31 921 2

原创 无形的筛子

无形的筛子,在你不知不觉中,已将你淘汰。  你现在回想起高中时,竞争是那么的激烈,每一天都是那样的紧张,分与分的比拼,让你不知明天还有多少试卷要做。想想那时候,每一天都会有同学不堪忍受高中的“黑暗”而回家享乐,每一天很多同学都因为这样那样的原因中途辍学了,生活是那么的紧张,也许一不小心,下一个被筛掉的人就是你了。你一直坚持着,你不停的努力,为什么?为的不就是能考上一个好一点

2013-05-09 21:12:22 1016 2

原创 有一分数序列: 2/1 3/2 5/3 8/5 13/8 21/13...... 求出这个数列的前N项之和,保留两位小数。

#include #include using namespace std;int main(){ int i,t; double n=2,m=1; double sum=0; int num; cin>>num; for(i=0;i<num;i++) { sum=sum+n/m;

2013-05-09 11:45:03 3640

原创 求sn=a+aa+aaa+aaa......+aa...a(n个a)之值,其中a是一个数字,例如:2+22+222+2222+22222(此时n=5),n由键盘输入

突然想做一做课后题,不做不知道,原来课后题这么多学问,#includeusing namespace std;int main(){ int a,n; int i,tn=0,sn=0;//声明tn,sn都为0; cin>>a>>n; for(i=0;i<=n;i++)//做一个循环 { sn=sn+tn;//a+aa+aaa...... tn=tn*10

2013-04-27 15:38:04 4820

原创 通过函数来实现复数相加

最近在学运算符重载,编了个程序权当练练手吧,呵呵#include using namespace std;class Complex//定义Complex类{public: Complex(){real=0;imag=0;}//定义构造函数 Complex(double r,double i){real=r;imag=i;}//构造函数重载 C

2013-04-22 18:36:13 1810 1

原创 杭电1008

//前往同一层的情况要考虑//fabs()函数,头文件#include//n=-123;fabs(n)=123;#include //#include using namespace std;int main(){ int N,count; while(cin>>N) { if(N==0) break;

2013-12-06 09:08:12 875

转载 Number Sequence

#includeint f[200];int main(){ int a,b,n,i; while(scanf("%d%d%d",&a,&b,&n)&&a&&b&&n) { if(n>=3) { f[1]=1;f[2]=1; for(i=3;i<=200;i++)

2013-11-27 11:25:55 789

原创 Let the Balloon Rise

Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest i

2013-11-27 08:35:51 875

原创 【任务4.1】:求从P到A的最短路径

#include using namespace std;int min(int,int); int main() // 主函数 { int h[4][3]={ {3,2,3},{2,1,4},{3,4,5},{3,1,2} }; int v[3][4]={ {2,2,3,4},{4,1,2,4},{1,2,2,3} };

2013-10-21 16:45:24 803

原创 Number Sequence

#include using namespace std;int main(){ int A,B,n; while(cin>>A>>B>>n) { if(A==0&&B==0&&n==0)//当A,B,n都为0时结束 break; int f[n]; f[1]=1;f[2]=1;

2013-10-18 09:35:42 888

原创 谁是作案人

#include using namespace std;int main(){ for(int A=0;A<=1;++A) for(int B=0;B<=1;++B) for(int C=0;C<=1;++C) for(int D=0;D<=1;++D) for(int E=0;E<=1;++E) for

2013-09-29 09:21:05 1189

原创 未完成代码

/*# include# include# includeint main(){ int T; char Astring[20][1000]; char Bstring[20][1000]; int Cresult[20][1002]; int length[20]; int temp; int i,j;

2013-09-27 09:25:03 935

原创 母牛的故事

#include using namespace std;int main(){ long long num[55]; num[1]=1;num[2]=2;num[3]=3; for(int i=4;i<55;++i) { num[i]=num[i-1]+num[i-3]; } int year;

2013-09-18 11:51:50 833

原创 A Mathematical Curiosity

#include using namespace std;int main(){ int n, m;//输入 int r, a, b, c; int N;//情况 cin>>N; for(int i=0;i<N;i++) { c = 0; while (cin>>n>>m) { if (n == 0 && m == 0)

2013-09-13 09:01:44 1019

原创 Sum Problem

#include using namespace std;int main(){ int n,sum=0; while(cin>>n) { for(int j=0;j<=n;j++) sum=sum+j; cout<<sum<<endl<<endl; sum=0; }

2013-09-13 08:28:52 741

原创 四个人C说谎

#include using namespace std;int main(){ char lier; int sum,g=1; for(int k=0;k<4;++k) { lier='A'+k; sum=(lier!='A')+(lier=='C')+(lier=='D')+(lier!='D');

2013-09-11 08:21:17 1305 2

原创 二维数组的转置

class MatricReverse { public static void main(String[] args) { int matrix[][]={{1,2,3},{4,5,6}}; int reverseMatrix[][]=new int[3][2]; System.out.println("原始数组:"); for(int i=0;i<matr

2013-09-10 19:19:52 1102

原创 两个矩阵的相加和相乘

//两个矩阵相加和相乘public class TestMatrixOperation{ public static void main(String[] args) { int [][]matrix1=new int[5][5]; int [][]matrix2=new int[5][5]; //随机分配值 for(int i=0;i<matri

2013-09-10 19:04:28 6657

原创 Let the Balloon Rise

#include using namespace std;int main(){ int num; while (cin>>num) { string temp; int i,j; int count=0; int max=0; if(num==0) brea

2013-09-06 09:17:34 1065

原创 暑假实践活动报告

今年的暑假是我觉得最有意义的暑假之一,因为我和我的同学们一起出了趟远门。我觉得这是非常有意义,也是非常开心的。说实话,这个暑假是我第一次坐轮船,很激动。也许是天公作美,烟台下了几天的雨,在我们出发的那天居然放晴了,这样心情也舒适了好多。尤其是我和我的同学们在甲板上一起看大海的风景,一起娱乐,一起倾听海鸥的歌声,在房间里和同学们一起斗地主,聊天,嬉笑,这些都是非常有意思的。这样安宁的生活,我是非

2013-07-23 19:55:56 1396 1

原创 VC++6.0中mfc的使用——坐标点的显示

最近学到了一点mfc中的皮毛,总结一下,顺便再熟悉一下。   首先,打开VC++6.0,File-new-Project-MFC AppWizard(exe);Projectname我写的是new5,存在了d盘中单击ok,之后选择Single document,单击Finish,ok,这时编译运行会出现一个窗口,好,第一步成功了。   接下来,找到FileView中的new5view.

2013-07-18 18:49:45 2033

原创 C++的思维导图

上一张不清楚,来张清楚的。

2013-06-17 12:40:52 1094

原创 C++的思维导图

2013-06-17 12:35:37 944

原创 找其中的韵母

#include #include using namespace std;int main(){ char c; while((c=getchar())!='\n') { if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') cout<<c; else cont

2013-06-11 11:31:22 790

原创 重载单目运算符

#include #include //#include //#include using namespace std;class Time{public: Time(){minute=0;sec=0;} Time (int m,int s):minute(m),sec(s){} Time operator++(); void

2013-06-10 19:20:11 696

原创 双目运算符的重载

#include #include //#include //#include using namespace std;class String{public: String(){p=NULL;} String(char *str); friend bool operator>(String &string1,String &strin

2013-06-10 19:06:42 773

原创 类模板的应用

#include using namespace std;templateclass Compare{ public: Compare(numtype a,numtype b):x(a),y(b){}; numtype max() { return (x>y)?x:y; } numtype min()

2013-06-04 20:41:54 704

原创 将普通函数声明为友元函数

#include using namespace std;class Time{ public: Time (int h,int m,int s):hour(h),minute(m),sec(s){}; friend void display(Time &); private: int hour; int minute;

2013-06-04 20:21:24 856

原创 基类与派生

#include #include using namespace std;class Teacher{public: Teacher(int ,char[],char); void display();private: int num; char name[20]; char sex;};Teacher::Te

2013-06-03 18:57:08 711

原创 Sample Input72 101 108 108 111 44Sample Output Hello, world!

#include //#include //#include //#include using namespace std;int main(){ int a[13]; for(int i=0;i<=5;i++) cin>>a[i]; for(int j=6;j<=12;j++) cin>>a[j]; for(

2013-05-29 14:45:01 992

原创 输入一行电报文字,将字母变成其下一字母(如’a’变成’b’……’z’变成’a’其它字符不变)。

#include #include #include #include using namespace std;int main(){ char c; while((c=getchar())!='\n') { cout<<char(c+1); } cout<<endl; return

2013-05-29 14:30:02 9125

原创 分别用函数和带参的宏,从三个数中找出最大的数。

#include #include #include #define max1(a,b,c) cout<<a<<endlusing namespace std;void max(float a,float b,float c){ if(a<b) a=b; if(a<c) a=c; cout<<setiosflags(ios::fixed)<

2013-05-29 14:14:50 2812

原创 已有一个已排好的9个元素的数组,今输入一个数要求按原来排序的规律将它插入数组中

#include using namespace std;int main(){ int a[9],i; for(i=0;i<9;i++) cin>>a[i]; int n; cin>>n; int t; for(i=0;i<9;i++) { t=i; if(a[t]>n)

2013-05-28 10:08:50 5679 1

原创 用筛法求之N内的素数。

#include #include #include using namespace std;int main(){ int n,i; cin>>n; int a[n]; for(i=1;i<=n;i++) a[i]=i; a[1]=0; for(i=2;i<sqrt(n);i++) for(i

2013-05-28 10:04:59 1270 1

原创 用选择法对10个整数从小到大排序。

#include #include #include using namespace std;int main(){ int a[10],i,j,temp,min; for(i=0;i<=9;i++) cin>>a[i]; for(i=0;i<=8;i++) { min=i; for(j=i+1;

2013-05-20 18:41:38 2526

原创 用迭代法求 。求平方根的迭代公式为: X[n+1]=1/2(X[n]+a/X[n]) 要求前后两次求出的得差的绝对值少于0.00001。输出保留3位小数

#include #include #include using namespace std;int main(){ float x0,x1; int a; cin>>a; x0=a/2; x1=(x0+a/x0)/2; while(fabs(x0-x1)>=1e-5) { x0=x

2013-05-20 18:21:14 10600

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除