NEED HELP WITH LOOP

i messed up somewhere along the lines of making this. I need the program to ask the user over and over agin when they give an invalid answer like anything other then an UPPERCASE letter that its asking for. this is what i have so far...



#include <iostream>
#include <string>
using namespace std;

//declaring funcitons
double NewYork(double commision1);
double AmericanStock(double commission2);
double OverCounter(double Commision3);
bool TypeOfTrans(char Trans);
bool LocationOfTrans ( char Loc);
bool Amt( double num1);
int main()
{
//setting my variables
string Name;
double Amount;
char TransactionType, PlaceOfExchange;
bool CheckType, CheckLoc, CheckAmount, valid;



//ask for name
cout << " Enter Brokers Name " << endl << endl;
cin >> Name;




//ask for the amount of transaction
cout << " What Was the Amount of Your Transaction " << endl << endl;
cin >> Amount;


CheckAmount = Amt(Amount);
if (CheckAmount == false)
{
cout << " Invalid Entry, Please Enter a Valid Number " <<endl <<endl;
}

//else
//{


//ask if its a purchase or sale
cout << " Type 'P' for Purchase or 'S' for Sale " <<endl << endl;
cin >> TransactionType;

//checks to see if the input was a valid answer i.e an uppercase P or S
CheckType = TypeOfTrans(TransactionType);

//error messege
if (CheckType == false)
{
cout << " Invalid Entry, Please Enter a 'P' or a 'S'. " <<endl <<endl;
}

//else
//{

//ask wherre transaction took place
cout << " Where Did This Transaction Take Place, Type 'N' for New York Exchange, 'A' for American Stock Exchange, or 'O' for Over the Counter " << endl <<endl;
cin >> PlaceOfExchange;

//checks to see if input was a valid answer i.e. an uppercase N, A, or O
CheckLoc = LocationOfTrans(PlaceOfExchange);

//error messege
if (CheckLoc == false)
{
cout << " Invalid Entry, Please Enter A 'N' for New York Exchange, 'A' for American Stock Exchange, or 'O' for Over the Counter " <<endl << endl;
}

//}













system("pause");
return 0 ;
}

//function that checks the letter
bool TypeOfTrans (char Trans)
{

if(Trans == 'S' || Trans == 'P')
{
return true;
}

else
return false;

}


//function that checks the letter
bool LocationOfTrans (char Loc)
{

if(Loc == 'N' || Loc == 'A' || Loc == 'O')
{
return true;
}

else
return false;
}

//function that checks amount
bool Amt (double num1)
{
if(num1 <= 0 ||num1 <= 0)
{
return false;
}

else
return true;
}
Topic archived. No new replies allowed.