below is my code the whole program is for prompting user to enter 10 nos. b/w 20 to 100 it will while is there to check wheter the user entr the corect number or not, it will also check that the entered number is unique and was not previously entered by the user. at end of program simply it will display the non dublicate nos. whole program is correct but at end it is not displaying correct result. plz check the code n tell me wherz my mistake.
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
int nTmp,j;
//declares variable bflag th be of type bool & intializes bflag to false
//bool is a data type whose value may be false or true
bool bFlag=false;
int a[10];
cout<<"entr 10 numbers b/w 20 and 100"<<endl;
for(int i=0;i<10;i++)
{
cout<<"Enter Value"<<endl;
cin>>nTmp;
while(!bFlag)
{
////Here we check first Condition
// no between 20 and 100
while((nTmp<20)||(nTmp>100))
{
cout<<"enter no b/w 20 and 100"<<endl;
cin>>nTmp;
}
j=0;
while(j<=i)
{
if(a[j++]==nTmp)
{
bFlag=false;
}
bFlag=true;
}
if(bFlag==true)
{
//save variable
a[i]=nTmp;
}
}
//again make it false
bFlag=false;
}
cout<<" the non dublicate nos are "<<a[i]<<endl;
getch();
}
Code formatted and tags added. -Narue
Rose