i need to create a program that will accept 5 numerical inputs and determine the highest, and i also need to stop user from using the same number twice and do not count it from the 5 numerical inputs. kindly help me, here is my code
Code:
int number,x,j=5;
int max=0;
int main(){
do{
for(int i=0; i<j; i++)
{
cout<<"\nInput number :";
cin>>number;
if(number>max)
{
max = number;
x=0;
}
else if (number == max)
{
cout<<"\nDo not use the same number twice! Please Try again!";
i--;
x=1;
}
}
}while(x==1);
cout<<"The highest number is: "<<max;
getch();
clrscr();
return 0;
}