This is the program below, program runs great, only thing I am confused about is fixing: if(raffle(number)==false) so it can say on the file "The number "XX" is not present in the array" Also if you see any mistakes please point them out so I can learn to be a better programmer. Thanks.
cout<<endl;
cout<<"Please enter a positive integer number: ";
cin>>number;
cout<<endl;
cout<<"A[scii]\t\tR[affle]\t\tE[xit]";
cout<<endl;
cout<<"Please select an option:";
cin>>select;
cout<<endl;
switch (select)
{
case 'a':
case 'A':
ascii(number);
break;
case 'r':
case 'R':
if(raffle(number)==true);
output<<"The number "<<number<<" is present in the array";
output.close();
break;
if(raffle(number)==false);
output<<"The number "<<number<<" is not present in the array";
output.close();
break;
case 'e':
case 'E':
return 0;
}
}
void ascii (int number)
{
if(number>47 && number<58)
cout<<"The number corresponds to a digit"<<endl<<endl;
else
if(number>64 && number<90)
cout<<"The number corresponds to a uppercase letter"<<endl<<endl;
else
if(number>96 && number<123)
cout<<"The number corresponds to a lowercase letter"<<endl<<endl;
else
cout<<"The number does not correspond to uppercase letter, lowercase letter, or digit"<<endl<<endl;
for(int i=0; i<5; i++)
{
if(number==array[i])
{
cout<<endl;
cout<<"The number can be found in position "<<i+1<<" of the array"<<endl<<endl;
return true;
}
}
for(int i=0; i<5; i++)
{
if(number!=array[i])
{
cout<<endl;
cout<<"The number was not found in the array"<<endl<<endl;
return false;
}
}
if(raffle(number)) // Unnecessary: ==true);<- Note that a semicolon directly after if is wrong
output<<"The number "<<number<<" is present in the array";
else
output<<"The number "<<number<<" is not present in the array";
output.close();
break;