热门

最新

红包

立Flag

投票

同城

我的

发布
wind_an
boboj1
4 年前
truewind_an

last-child为什么选不中

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
大神看看哪里错了#include<iostream>#include<iomanip>using namespace std;bool prime(int);void main(void){ int a[10],b[10], i,j,x=0,t; cout<<"请输入10个正整数:"<<endl; for(i=0;i<10;i++) cin>>a[i]; t=a[0]; for(i=0;i<10;i++) if(t<a[i]) {t=a[i];x=i;} cout<<"数组中的最大值为:"<<t<<"其下标为:"<<x<<endl; t=a[0]; for(i=0;i<10;i++) if(t>a[i]) {t=a[i];x=i;} cout<<"数组中的最小值为:"<<t<<"其下标为:"<<x<<endl; for(i=0,j=0;i<10,j<10;i++) if(prime(a[i])) {b[i]=a[i];j++;} for(i=9;i>=0;i--) if(b[i]==0) continue; else cout<<setw(4)<<b[i]; cout<<endl;}bool prime(int a[10]){ int i,j; bool flag=1; for(i=0;i<10;i++) for(j=2;j<a[i];j++) if(a[i]%j==0) {flag=0;break;} return flag;}
立即登录