lzth.net
当前位置:首页 >> 用C++语言编程4道题,急用 >>

用C++语言编程4道题,急用

#include using namespace std;int main(){ int i,a,b; int k=0,m,n,t; int ch=0; couta>>b; while(ch!=2&&ch!=3){ coutch; } if(ch==2){ coutm>>n; } if(ch==3){ coutm>>n>>t; } for(i=a;i

#include using namespace std; int main() { int i,j,k; for(i=1;i

#include using namespace std;int gcd(int a, int b){ int min; min = a>b?b:a; while(min) { if(a%min==0 && b %min == 0) break; min--; } return min;}int main(){ int *a; int n; int r,i; cout >n; a=new int[n]; cout

#include #include using namespace std;//仅用于双偶数幻方void magic(int col){//定义动态二维数组int i,j,m,n;int **magic = new int *[col];for(i=0;i

int max(int a,int b) { return a>b?a:b; } int main() { int a,b,c,d; cin>>a>>b>>c>>d; cout

稍等

最愚蠢的方法: # include main() { float a,b,c,d,t; scanf("%f,%f,%f,%f",&a,&b,&c,&d); if(a>b) {t=a;a=b;b=t); if(a>c) {t=a;a=c;c=b}; if(a>d) {t=a;a=d;d=t); if(b>c) {t=b;b=c;c=t}; if(b>d) {t=b;b=d;d=t}; if(c>d) {t=c;c=d;d=t}; prin...

#include #include using namespace std; void main(){ int a[4],b; int i,j=0,k; for(i=0;i

#include#includeint main(){int a,b,c,d,sum;while(scanf("%d %d %d %d",&a,&b,&c,&d) == 4) {sum = a+b+c+d;printf("和为 :%d\t平均值为%.2lf\n",sum,sum/4.0);}return 0;}

for循环后面是没有分号的,可以不用计算,直接输出即可 #include using namespace std;int main(){ int x,y,z,a; for (int x=1;x

网站首页 | 网站地图
All rights reserved Powered by www.lzth.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com