好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

C++低学阶例题(中难版)十.docx

9页
  • 卖家[上传人]:芝****量
  • 文档编号:232396118
  • 上传时间:2021-12-30
  • 文档格式:DOCX
  • 文档大小:20.31KB
  • / 9 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • C++ 低学阶 例题题目一:输入n,然后用函数输出n行hello world输入:一行一个数 为n 其中n<=1000输出:共n行 每行内容为hello world代码:#includeusing namespace std;void hello(){ cout<<"hello world";}int main(){ int n; cin>>n; for(int i=0;iusing namespace std;int main(){ int a,b,s=1; cin>>a>>b; for(int i =0;i=10&&s<100) { cout<<0<using namespace std;int main(){ int a,b,t; cin>>a>>b; switch(b) { case 1: case 7: case 3: case 5: case 8: case 10: case 12: { t=31; break; } case 4: case 6: case 9: case 11: { t=30; break; } case 2: { if(a%4==0&&a%100!=0||a%400==0) { t=29; } else { t=28; } } } cout<

      新数也应满足整数的常见形式,即除非给定的原数为零,否则反转后得到的新数的最高位数字不应为零,例如输入-380,反转后得到的新数为-83输入:输入共 1 行,一个整数N1,000,000,000 ≤ N≤ 1,000,000,000输出:输出共 1 行,一个整数,表示反转后的新数代码:#includeusing namespace std;int main(){ int a,b=1; cin>>a; if(a<0) { cout<<"-"; a=-a; } while(a!=0) { b=a%10; a/=10; if(b!=0) cout<using namespace std;int main(){ int m,k,a=0,c; cin>>m>>k; if(m%19==0) { while(m>0) { c=m%10; if(c==3) { a++; } m=m/10; } if(a==k) { cout<<"YES"; } } else{ cout<<"NO"; } return 0;}9。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.