【发布时间】:2011-10-19 14:32:34
【问题描述】:
你们过去帮了我很多,我回来寻求更多帮助!
我正在为学校做另一项 C++ 作业。我必须从用户那里收集 10 到 100 之间的 20 个数字,然后将它们全部比较并打印出不重复的数字。
我坚持的部分是试图让用户输入循环,直到我拥有所有 20 个数字。我所拥有的对我来说很有意义,但它显然不起作用。对不起,可笑的cmets,我必须为课堂评论所有内容。
任何你能揭露我的愚蠢行为都会令人惊叹!非常感谢!
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
}
【问题讨论】: