用c++语言编程,用数组存放10个数,编写程序求这个10个中最大值及其所在的下标.

日期:2013-11-10 23:28:38 人气:2

用c++语言编程,用数组存放10个数,编写程序求这个10个中最大值及其所在的下标.

#include using namespace std; void main() { int a[10]; int i; for(i=0; i<10; ++i) cin>>a[i]; int max=a[0], maxi=0; for(i=1; i<10; ++i) if(a[i] > max) { max = a[i];
    A+
热门评论