Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. char getTypeAcc();
  7. int getAccNum();
  8.  
  9.  
  10. char accountType;
  11. int accountNum;
  12.  
  13. accountNum= getAccNum();
  14. accountType= getTypeAcc();
  15.  
  16. }
  17.  
  18. // get account number
  19. int getAccNum() {
  20. int num;
  21. cout << "Enter account number: ";
  22. cin >> num;
  23. while(num <= 0) {
  24. cout << "Error!";
  25. cout << "\nEnter account number: ";
  26. cin >> num;
  27. }
  28. return num;
  29. }
  30.  
  31. // get the type of account
  32. char getTypeAcc() {
  33. char type;
  34. cout << "Enter account type: ";
  35. cin >> type;
  36. while(type != 'c','C','p','P') {
  37. cout << "Account type must be C or P!";
  38. cout << "\nEnter the account type: ";
  39. cin >> type;
  40. }
  41. return type;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement