以前你們都幫過我很多,我回來尋求更多幫助!循環詢問用戶輸入數組
我正在爲學校的另一個C++作業。我必須從用戶那裏收集10到100之間的20個數字,並將它們全部進行比較並打印出不重複的數字。
我堅持的部分是試圖讓用戶輸入循環,直到我有全部20個數字。我對我有意義,但它顯然不工作。對於荒謬的評論感到抱歉,我不得不爲評論評論一切。
任何光線可以灑在我的身上會是驚人的!非常感謝!
int FindDuplicates[20]; // my little array
int UserInput; // the number from the user to compare
int count; // the number of numbers entered
for(count=0; count<FindDuplicates; count++;) // what I am trying to do is have count start at 0. as long as it is less than the max array, add 1 to the count
{
cout << "Please enter a number between 10 and 100: "; // print out what I would like
cin >> UserInput; // get the number from the user
}
非常感謝!現在看來這很容易,我明白了!我只需添加一行,將UserInput添加到由count標記的插槽中的陣列中! – audiedoggie