要怎麼寫輸入任意八個數去比較大小的程式呢,要如何寫呢?請大家幫幫忙一下
2006-12-03 12:07:02 · 3 個解答 · 發問者 恰恰 1 in 電腦與網際網路 ➔ 程式設計
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main(void)
{
int num;
cout<<"how many number which you want to key in :";
cin>>num;
int *num_array = new int[num];
for(int i=0; i
cout<<"please key in the no."<
cin>>num_array[i];
}
vector
sort(array1.begin(),array1.end());
int max = *( array1.end() - 1 );
int min = *( array1.begin() );
cout<<"max = "<
delete []num_array;
system("pause");
return 0;
}
2006-12-04 12:17:33 · answer #1 · answered by 小梁 3 · 0⤊ 0⤋
#include
using namespace std;
int main()
{ const
int num=8;
int in[num];
for(int i=0;i
for(int j=0;j
in[j]=in[k];
in[k]=out;
}
}
}
for(int s=0;s
}
return 0;
}
2006-12-04 17:05:04 補充:
第四行的是同一行const int num=8;
2006-12-04 12:01:45 · answer #2 · answered by Oo瞇瞇眼oO 1 · 0⤊ 0⤋
//Power by Microsoft Visual Studio 2005//可以使用 Dev-C++ 編譯此程式#include
2006-12-03 13:06:33 · answer #3 · answered by Big_John-tw 7 · 0⤊ 0⤋