-
November 18th, 2009, 02:27 AM
#1
Need help with basic array program. Won't run.
I made a program that reads in20 numbers, each between 10 to 100 and if a user inputs a number not in that range they are asked to re-input. After reading in all the values, I need to display all the unique vclues.
Thanks!
Code:
#include <iostream>
using namespace std;
int counter = 0;
int num = 0;
int main ()
{
int array = new array [20];
while(counter <= 20){
cin << num;
if(num>=10 && num<=100){
array[counter] = num;
counter++;
}
else {
cout << "Enter a number between 1 and 10";
}
}
for(int x=0; x<=20; x++)
{
cout << array[x];
}
return 0;
}
-
November 18th, 2009, 06:54 AM
#2
Re: Need help with basic array program. Won't run.
What is your question about your post ?
-
November 18th, 2009, 08:10 AM
#3
Re: Need help with basic array program. Won't run.
I would have an array size of 90 with all elements initialized to 0.
Given that as a starting point, think about what you'd need to change.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|