1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
#include "header.h"
using namespace std;
void input (int & accountNumber, char & accountType, float & minimumBalance, float & currentBalance)
{
cout << "enter account number, account type, minimum balance, and current balance." <<endl;
cin >> accountNumber >> accountType >> minimumBalance >> currentBalance;
while (accountNumber < 10000 || accountNumber > 99999)
{
cout << "INVALID DATA" << endl;
cout << "Account must be a 5 digit integer (i.e. 10000 thru 99999)." << endl;
cout << "try again:" << endl << endl;
input (accountNumber, accountType, minimumBalance, currentBalance);
}
//!!!HERE is the problem. how would i do this?
while ((accountType != 'c') || (accountType != 'C') && (accountType != 's') || (accountType != 'S'))
{
cout << "INVALID DATA" << endl;
cout << "Account type must be c, C, s or S." << endl;
cout << "try again:" << endl << endl;
input (accountNumber, accountType, minimumBalance, currentBalance);
}
while (minimumBalance < 1000)
{
cout << "INVALID DATA" << endl;
cout << "Minimum balance must be greater than or equal to 1000." << endl;
cout << "try again:" << endl << endl;
input (accountNumber, accountType, minimumBalance, currentBalance);
}
while (currentBalance < 0)
{
cout << "INVALID DATA" << endl;
cout << "Current balance must be non-negative." << endl;
cout << "try again:" << endl << endl;
input (accountNumber, accountType, minimumBalance, currentBalance);
}
}
|