|
From: PETER C. <pca...@cc...> - 2004-07-04 19:48:19
|
cpp freshman asks for help again...i want this program to request the user for 20 numbers within the range 10<x<100 and print the 20 numbers. if the numbers have any duplicates the numbers must be re-entered.
i have a parse error at the end of the program. i've read thru the program a few times but can't find it. **David, i am trying to think more about my programs and what i want them to do. i made a flow chart for this one. another question, is it possible to use rand()/rand_max in anyway in this program?
thanx again everyone
panos.....GO GREEECE EURO 2004:)
#include <iostream>
using namespace std;
int main(){
int numbs;
int num[20];
for (int i=0; i<20; i++){
cout << "what are the numbers? ";
cin >> numbs;
num[i] = numbs;
if (num[i] = num[i])
{
cout << "you have entered a duplicate. Try again. ";
cin >> numbs;
num[i] = numbs;
}
else if (numbs <= 10 || numbs >= 100)
{
cout << "you have entered a value out of range. try again. ";
cin >> numbs;
num[i] = numbs;
}
else
cout << "the numbers are" << num[i] << endl;
return 0;
}
______________ ______________ ______________ ______________
ccny.cuny.edu
|