hello everybody!
I got a very big problem on inputting nd displaying the arrays. As Im new to programming specially to this topic..this is the question nd the code
Write a program that populates an array of size 20 with random integer numbers between the ranges of 1 to 100 (inclusive). Then repeatedly asks the user to enter a number. For each number entered, display the position of that number in the array. If the number doesn’t exist, display a message indicating that the number is not found. If the number appears more than one time, in the array, display all the positions. The user should be asked to enter a sentinel value if no more search is needed.
include<iostream>
using namespace std ;
const int no=20 ;
int main()
{
int array[20]={12,22,56,45,78.96,63,74,55,77,99,88,33,22,11,44, 72,29,31,30} ;
int i , val ;
for ( i = 0; i<no ; i++ )
{
cout << " please enter a value " << endl ;
cin>> val ;
for ( int i = 0 ; i<array[no-1] ; i++ )
{
cout << i << endl ;
}
}