c++码酷题目答案_第1页
c++码酷题目答案_第2页
c++码酷题目答案_第3页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、ttinclude <iostream> using namespace std;int main()int a, b;cin >> a >> b;cout << a+b << endl;return 0;0002ttinclude <cstdlib>ttinclude <iostream> using namespace std;int main()cout? , Hello World! /z; return EXIT_SUCCESS;0003ttinclude <cstdlib>ttinclu

2、de <iostream> using namespace std;int main (int argc, char *argv)cout<< * < endl; cout? / , * < endl;cout<< * <<endl; return EXIT_SUCCESS;0009ttinclude <iostream> using namespace std;int main()int a, b; cin >> a >> b; cout << a+b << endl;re

3、turn 0;0010ttinclude <iostream> using namespace std;int main()int a, b;cin >> a >> b;cout << ab << endl;return 0;0011#include<iostream> using namespace std; int main()long long a, b;long long m; cin>>a>>b;m 二 a*b;cout<<m;0012ttinclude <cstdlib

4、> ttinclude<iostream>using namespace std;int main (int argc, char *argv)int a, b;cin >> a >> b;cout << a + b << endl;/system( PAUSE );return 0;ttinclude <cstdlib>ttinclude <iostream> using namespace std; int main()long long int a, b;char c;cin >> a

5、>> c >> b; cout << a*b;return EXIT_SUCCESS;0016ttinclude <iostream> using namespace std; int main()int i, j=0, k;int a 6;cin>>k;while (k!=0)i=k%10; aj=i; j+ ; k=k/10;for (i=0;i<j;i+)cout<<ai; /system( PAUSE ); return 0;0015#include<cstdlib>ttinclude <i

6、ostream> using namespace std; int main (int argc, char *argv)int n;int h, m, s; cin>>n;h=n/3600; m=n%3600/60;s=n%60;z ,cout?h/10?h%10? : <m/10 ni%10 : <<s/10?s%10?endl; /system( PAUSE );return EXIT_SUCCESS;0017ttinclude <cstdlib> ttinclude <iostream>using namespace std;

7、int main (int argc, char *argv)int a; cin>>a; cout a*10;/system( PAUSE ); return EXIT_SUCCESS;0014ttinclude <cstdlib> ttinclude <iostream> using namespace std;int main (int argc, char *argv)int hl, fl, ml;int h2, f2, m2;char fh;cin >>hl>>fh>>fl>>fh>>ml

8、;/time 1cin ?h2?fh?f2?fh?m2;/time 2cout <<(3600*hl+60*f1+ml)-(3600*h2+60*f2+m2); return EXIT_SUCCESS;0020#include<cstring> using namespace std;int main (int argc, char *argv)char s 101;int i, 1;cin. getline (s, 101);l=strlen(s);for(i=0;i<=l-l;i+)switch (s i)(case'Z'i = , ;brea

9、k;case'O' : si='O'break; case , r :si='break;si='2' ;break;case's' :si=' 5" ;break; case'b' : scase'B' : si='8" ;break; case'q' :si='9" ;break; cout<<s<<endl;/system( PAUSE );return EXIT_SUCCESS;0008tt

10、include <stdio. h>int main() int m, n;scanf ( d%d, &m, &n);if (m % 2 = 1 && n % 2 = 1) printf ("second!n ); else printf ("first!n );return 0;using n amespace std;int main (int argc, char *argv)int a, b, c;cin> >a»b»c;if (a>b) if (a>c) cout<<

11、;a; else cout<<c; else if (b>c) cout<<b; else cout«c;system( PAUSE,); return EXIT_SUCCESS;0214ttinclude <iostream> ttinclude <stack> using namespace std; int n , t , k; char s13 , p13; bool b 25;int mai n()stack<char> c;ini , j;ti? n;ni? s ?p;尚(i = 0 ; i < n

12、;:i+r)c. push(si);bk+ = 0;while (pt 二二 c. topO)t+;c. pop ();bk+ = 1; if (c. empty () break;if (c. empty ()(cout << Yes. << endl;for (i = 0 ; i < k ; i+)if (bi = 0)cout << in << endl;elsecout << out << endl;elsecout << No. << endl;cout << "

13、;FINISH" << endl;/system( pause );return 0;0021ttinclude <iostream>ttinclude <stack>using namespace std;int main()int a, b;cin>>a>>b;if (b>a)cout<<b-a<<endl;elsecout<<a-b<<endl;return 0;0024ttinclude <cstdlib>ttinclude <iostream&

14、gt; using namespace std; int main()int a, b;cin>>a>>b; cout<<b/a+K<endl;return 0;0026CLSINPUT NX=N100Y=(N MOD 100)10Z=(N MOD 100) MOD 10IF X>Y THENSWAP X, YEND IFIF X>Z THENSWAP X, Z END IFIF Y>Z THENSWAP Y, ZEND IFPRINT LTRIM$(STR$(Z);PRINT LTRIM$(STR$(Y);PRINT LTRIM$(

15、STR$(X);END0022#include<iostream. h> int main ()long long int a; cin>>a;if (a%100!=0)if (a%4=0)cout? /z TRUE/z;elsecout<< FALSE ;else(if(a%400=0)cout? /z TRUE/z;elsecout<< FALSE ;/sysetem( PAUSE ); return 0;0027ttinclude <cstdlib> ttinclude <iostream>using namespa

16、ce std;int main(int argc, char *argv)int a, b, c; cin>>a>>b>>c; if(a<b) swap (a, b);if (a<c) swap (a, c);if (b<c) swap (b, c);if (a-b=l&&b-c=l) cout<< /z TRUEz <<endl; else cout <FALSE ;/system( PAUSE ); return EXIT SUCCESS;0217 #include<cstdio>

17、;#include<iostream> using namespace std; int main()long long v;scanf( I64d , &v); printf( I64d , v); if (v<=7959) printf( 0 );if (v>=7960) printf( 1 );if (v>=11200) printf (2 );if (v>=16700) printf( 3 );if (v>=115000) printf ( 4 );if (v>=2000000) printf ( 5 );return 0;002

18、8 ttinclude <cstdlib> ttinclude <iostream> using namespace std;int main(int argc, char *argv)long int y, m, d, a;char x;cin?y?x>>m?x?d;if(y%4=0&&y%100!=0 y%400=0) a=29; elsea=28;if(m>l) d=d+31;if(m>2) d=d+a;if(m>3)d=d+31;if(m>4)d=d+30;if(m>5)d=d+31; if(m>6

19、)d=d+30; if(m>7)d=d+31; if(m>8)d=d+31; if(m>9)d=d+30; if (m>10)d=d+31;if (m>ll)d=d+31; cout<<d<<endl; /system( PAUSE ); return EXIT_SUCCESS;0043ttinclude <cstdlib> ttinclude <iostream>using namespace std;int main (int argc, char *argv) char a100, m;int n, i;cin

20、>>n>>m;i=n;while (n>0)ai-n=m; ai-n+l='0' cout<<a<<endl; n;return EXIT_SUCCESS;ttinclude <cstdlib>ttinclude <iostream> using namespace std;int main (int argc, char *argv)int s, n, c; cin>>c;s=0;n=l;while (n<=c) s=s+(l+n)*n/2; n=n+l;cout<<s

21、;/system( PAUSE ); return EXIT_SUCCESS;0023#include<iostream>using namespace std;int main()int a 4, b4;int f=0;int i; for(i=l;i<=3;i+) cin>>ai;for(i=l;i<=3;i+)cin>>b i;for(i=l;i<=3;i+)(if(ai>bi) 大了大了大了,做个标志,咱不用接着往下跑了 我走f=l ;break;elseif(ai<bi)/ 小了,做标志,走人 f=-l;break;i

22、f(f=l) cout<< z'First /z <<endl;else if(f=-l)cout<< Second <<endl; elsecout<< Same< endl;/ system ( /Z PAUSE/Z ); return 0;0047ttinclude <cstdlib>ttinclude <iostream>ttinclude <iomanip>using namespace std;int main (int argc, char *argv)int a, b;

23、char k;cin >>a>>k>>b;if (k 二二 '/' &&b=0)(cout? zz ERR0R!zz;else if(k='+')(cout <<a+b<<endl;else if(k='-')(cout <<a-b<<endl;else if(k='*')cout <<a*b<<endl;else if (k= /')(if(a%b=0)(cout <<a/b<&l

24、t;endl;else(cout <<fixed <<showpoint<< setprecision(2);cout <<(a*l. 0)/b<<endl;return EXIT_SUCCESS:0039"n elude <cstdlib>"n elude <iostream>using namespace std;int main(int argc, char *argv)cout " 50700” endl;/system("PAUSE");return

25、EXIT_SUCCESS:0007#include<stdio. h>int main ()int a1616=0;int i, j, n, m;for(i=l;i<16;i+)for(j=l;j<=i:j+)if (j=l)ai j=i;else ai j=ai-l jT*ai j-1/(ai j-l-ai-l j-1);while(scanf( d%d, &n, &m)!=EOF)(printf (z,l/%dn zz, an m);return 0;0005#include<iostream>using namespace std;int main()int n, i, j, m,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论