自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 第十九周oj刷题:算法编译器

#include #includeusing namespace std;int main(){ int a,b; char c; cin>>a>>b; cin>>c; if(c=='+')cout<<a+b; else if(c=='-')cout<<a-b; else if(c=='*')cout<<a*

2014-12-31 13:39:01 377

原创 第十九周oj刷题:时间差

#includeint main(){ int h1,h2,m1,m2,s1,s2,h,m,s; long tc; scanf("%d:%d:%d",&h1,&m1,&s1); scanf("%d:%d:%d",&h2,&m2,&s2); s=s1-s2;m=m1-m2;h=h1-h2; tc=h*3600l+m*60

2014-12-31 13:36:55 517

原创 第十九周oj刷题:多少花可以买

#include using namespace std;int main(){ int x,t,g,f,sum,a,b; cin>>x; if(x>=100) { t=x/100; g=20*t+t*5; f=(x-t*100)/5; b=f/5;

2014-12-31 13:35:17 360

原创 第十九周oj刷题:money problem

#include using namespace std;int main(){ double x,sum,t; cin>>x; if(x<=3)sum=8; else { if((x-3-(int)(x-3))>0) { t=(int)(x-3)+1;

2014-12-30 18:23:11 683

原创 第十九周oj刷题:求奖金总数

#include using namespace std;int main(){ int x,t; cin>>x; if(x<=100000)t=x*0.1; else if(x<=200000)t=10000+(x-100000)*0.075; else if(x<=400000)t=10000+100000*0.075+(x

2014-12-30 18:05:24 492

原创 第十九周oj刷题:成绩分类

#include using namespace std;int main(){ int score; cin>>score; if(score>=90)cout<<"A"; else if(score>=80)cout<<"B"; else if(score>=70)cout<<"C"; else if(score>

2014-12-30 17:49:10 407

原创 第十九周oj刷题:输出最大数

#include #include using namespace std;int main(){ int a,b,c,t; scanf("%d,%d,%d",&a,&b,&c); if(a<b) { t=a; a=b; b=t; } if(c>a) {

2014-12-30 17:43:03 458

原创 第十九周oj刷题:三角形的面积

#include #include#includeusing namespace std;int main(){ double a,b,c,s,p; cin>>a>>b>>c; p=(a+b+c)/2.0; if(a+b>c&&a+c>b&&b+c>a) { s=sqrt(p*(p-a)*(p-b)*(p-

2014-12-30 17:41:11 424

原创 第十九周oj刷题:她胖么?

#include #include #include //很重要using namespace std;int main(){ int cm;//cm为身高 double w,k;//w为实际体重,k为标准体重 cin>>cm>>w; k=cm-100;//为什么k=cm-100和cm-100=k不一样? if(w>1.2*

2014-12-30 17:39:43 398

原创 第十九周oj刷题:按要求输出数(2)

#include #include using namespace std;int main(){ float a; scanf("%f",&a); printf(" %.2f\n",a); printf(" %.2f %.2f\n",a,a); printf(" %.2f %.2f %.2f\n",a,a,a);

2014-12-30 17:38:00 407

原创 第十九周oj刷题:日期转换

#include #include using namespace std;int main(){ int Y,M,D; scanf("%d/%d/%d",&M,&D,&Y); printf("%d.%02d.%02d",Y,M,D); return 0;}

2014-12-30 17:37:00 409

原创 第十九周oj刷题:按要求输出数

#include #includeusing namespace std;int main(){ double x; cin>>x; cout<<setiosflags(ios::left)<<x<<endl; cout<<setiosflags(ios::left)<<setiosflags(ios::fixed)<<setprecis

2014-12-30 17:35:43 450

原创 第十九周oj刷题:三角形面积和体积

#include #includeusing namespace std;int main(){ double h,r,pi=3.14,s,v; cin>>r>>h; s=2*pi*r*r+2*pi*r*h; v=pi*r*r*h; cout<<setiosflags(ios::fixed)<<setprecision(2)<<

2014-12-30 17:34:03 437

原创 第十八周oj平台:用数字造数字

#include using namespace std;int main(){ int a[10],x,n=0,y,m,t,k; cin>>x; while(x!=0) { a[n]=x%10; x=x/10; n++; } for(y=0; y<n-1; y++) {

2014-12-27 20:28:10 389

原创 第十八周oj平台:保密电文

#include #includeusing namespace std;int main(){ char str[100]; int x; gets(str); for(x=0;str[x]!='\0';++x) { if((str[x]>='A'&&str[x]='a'&&str[x]<='v')) str[

2014-12-27 19:37:27 389

原创 第十八周oj平台二:关灯

#include using namespace std; int main() { int m,n,i; cin>>n>>m; for(i=1; i<n; ++i) { if ((i%m!=0)&&(i%10!=m)&&((i/10)%10!=m)&&((i/100)%10!=m)) cout<

2014-12-27 19:13:26 404

原创 第十七周项目五(1)(2):输出是第几天

#include using namespace std; struct time { int year; int month; int day; int hour; int minute; int second; }; int main() { time Ti

2014-12-27 16:02:28 364

原创 第十七周项目三:胖子伤不起

#include using namespace std;struct human{ string name; int sex; double high; double weight;};int main(){ human h1; double x; cout<<"请输入你的姓名:"; cin>>h1.name

2014-12-27 15:59:55 369

原创 第十七周项目四(2):生日差几天

#include using namespace std;struct Date{ int year; int month; int day;};int days(int,int,int);int main(){ Date date1,date2; cout<<"input player1's birthday year

2014-12-27 15:50:14 359

原创 第十七周项目四(1):日期结构体

#include using namespace std;struct Date{ int year; int month; int day;};int main(){ Date date; cout<<"input year,month,day:"; cin>>date.year>>date.month>>dat

2014-12-27 15:42:12 397

原创 第十七周项目二(2):指针做形参

#include using namespace std;void fun(int *x,int *y,int *z);int main(){ int a,b,c; cin>>a>>b>>c; fun(&a,&b,&c); cout<<a<<" "<<b<<" "<<c; return 0;}void fun(int *

2014-12-27 14:56:43 316

原创 第十七周项目二(1):引用做形参

#include using namespace std;void fun(int &x,int &y,int &z);int main(){ int a,b,c; cin>>a>>b>>c; fun(a,b,c); cout<<a<<" "<<b<<" "<<c; return 0;}void fun(int &x,i

2014-12-27 14:51:59 316

原创 第十七周项目一:体会函数参数传递

#include using namespace std;void fun1(int &x,int &y);void fun2(int *x, int *y);int main(){ int a,b; a=11; b=22; fun2(&a,&b); cout<<"a="<<a<<" b="<<b<<endl; fun

2014-12-27 14:39:01 296

原创 第十六周项目三:用函数指针调用函数

#includeusing namespace std;void eat();void sleep();void hitdoudou();void run(void (*f)());int main(){ int iChoice; do { cout<<"请选择(1-吃;2-睡;3-打;其他-退)"; cin>>iChoice

2014-12-14 16:06:42 360

原创 第十六周项目二(6):去除多余的空格

#include using namespace std;char *palltrim(char *str);int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; char s3[50]="vegetable bird! "; cout<<s1<<palltrim(s1)<

2014-12-14 15:44:56 343

原创 第十六周项目二(5):去除开头的空格

#include using namespace std;char *ptrim(char *str);int main(){ char s1[50]=" Hello world. "; char s2[50]=" Good morning. "; char s3[50]=" vegetable bird! "; cout<<s1<<*ptrim(s1)<

2014-12-14 15:31:01 384

原创 第十六周项目二(4):统计单词个数

#include using namespace std;int pwordnum(char *str);int main(){ char s1[50]="Hello world.My name is liyingjie. "; char s2[50]="Good morning."; char s3[50]="vegetable bird!"; cout

2014-12-14 15:05:55 449

原创 第十六周项目二(3):统计字符串长度

#include using namespace std;int pstrlen(char *str);int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; char s3[50]="vegetable bird! "; cout<<pstrlen(s1)<<'\n';

2014-12-14 14:44:49 612 1

原创 第十六周项目二(2):去除空格

#include using namespace std;char *astrcat(char str1[], const char str2[]);int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; char s3[50]="vegetable bird! "; ast

2014-12-14 14:37:40 355

原创 第十六周项目二(1)补充

#include #includeusing namespace std;char *astrcat(char str1[], const char str2[]);int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; char s3[50]="vegetable bird!

2014-12-11 15:26:49 305

原创 第十六周项目二(1):用指针玩转字符串

#include #includeusing namespace std;char *astrcat(char str1[], const char str2[]);int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; char s3[50]="vegetable bird! "

2014-12-11 15:23:33 312

原创 第十六周项目1:数组的排序

#include using namespace std;void sort(int *p, int num); //不要对自定义函数的声明有任何改动void output(int*, int); //形式参数的名称可以不要int main( ) //不要对main函数有任何改动{ int a[20]={86,46,22,18,77,45,32,80,26,88,57,67,2

2014-12-11 15:06:20 379

原创 第十六周oj平台(3):相同的数

#include using namespace std;int sameNum(int *a,int n1,int *b,int n2, int *c);int main(){ int a[50]; int b[50]; int c[50]; int i, n1, n2, n3; cin>>n1>>n2; for(i=0;i<n1;i++

2014-12-11 14:46:11 352

原创 第十六周oj平台(4):指针引出奇数因子

#includeusing namespace std;int fun(int x, int *pp);int main(){ int a[50],x,n; cin>>x; n=fun(x,a); cout<<n<<endl; for(int i=0; i<n; i++) cout<<a[i]<<" "; cout<<endl

2014-12-11 14:40:54 377

原创 第十四周项目五:体会棋盘游戏中的数据储存

#include #include #includeusing namespace std;void setdata(int a[8][8]); //设置随机数void out(int a[8][8]); //输出数组void outDiagonal(int a[8][8]); //输出对角线元素的值void mine(int a[8][8],int x, int y

2014-12-08 10:57:45 343

原创 第十五周项目二(2):阅读程序

#include using namespace std;int *p;void pp(int a,int *b);int main(){ int a=1,b=2,c=3; p=&b; pp(a+c,&b); cout<<"(2)"<<a<<','<<b<<','<<*p<<endl; return 0;}void pp(int a,int

2014-12-04 16:08:48 575 1

原创 第十五周项目2(1):阅读程序

#include using namespace std;int sub(int*);int main(){ int i,k; for(i=0;i<4;i++) { k=sub(&i); cout<<"sum="<<k<<'\n'; } cout<<"\n"; return 0;}int sub(int

2014-12-04 16:07:15 320

原创 第十五周项目一:内部寻内幕

#include using namespace std;int main(){ int a=2,b=3,c[5]={1,2,3,4,5}; int *p1,*p2,*p3; p1=&a; p2=&b; p3=c; p3++; (*p3)+=10; cout<<a<<'\t'<<b<<'\t'<<c[1]<<endl;

2014-12-04 16:06:00 410

原创 第十五周oj平台:两数和与差

#include using namespace std;void ast(int x,int y,int *cp,int *dp){ *cp=x+y; *dp=x-y;}int main(){ int a,b,c,d; cin>>a>>b; ast(a,b,&c,&d); cout<<c<<" "<<d<<endl; ret

2014-12-04 16:04:04 348

原创 第十五周oj平台:指针当形参

#include using namespace std;void jiaohuan(int *p1, int *p2);int main( ){ int a,b; cin>>a>>b; jiaohuan(&a,&b); cout<<a<<" "<<b<<endl; return 0;}void jiaohuan(int *p1, int *p2

2014-12-04 16:02:19 396

空空如也

空空如也

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

TA关注的人

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