Data validation Loop problem!

I am trying to make a loop that validates the data entered meet certain conditions. I got it to work with data that only has 1 or conditions to meet using the or (||) operator but on one piece of data there are 4 conditions to be met. This is hard to explain so Ill just post the code:

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);
         } 
 
}


If you see the code under the comment you can see what I am trying to do. It makes sense but I don't think it is possible using just those operators. Any suggestions?
What if you change your || operators to && in line 20. Then it will be the equivalent of while acountType is not c, C, s or S. I think this is what you want.
Yes! thank you so much!
Topic archived. No new replies allowed.