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;
}
Re: Need help with basic array program. Won't run.
What is your question about your post ?
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.