Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.64 KB | None | 0 0
  1. /*
  2. Mohanad Ayman Aly
  3. 20180296
  4. */
  5. #include <iostream>
  6. #include <string.h>
  7. #include <iomanip>
  8. #include <cmath>
  9.  
  10. using namespace std;
  11.  
  12. const int MAX_ADDRESS = 50, MIN_ADDRESS = 5;
  13. const int TRANSACTIONS = 10, CLIENTS = 20;
  14. const int MAX_NAME = 30, MIN_NAME = 3;
  15. const int MAX_TEMP = 20;
  16. const int BASEBALANCE = 5000;
  17. const char BREAK = '.';
  18. char cities[CLIENTS][MAX_ADDRESS];
  19. int citiesCounts[CLIENTS];
  20. int lastClient = 0;
  21. int userMaxTransactions, userMaxClients;
  22.  
  23. /////////////////////////////////////////////////////////////
  24. // Start of Function Prototypes
  25.  
  26. //Primary Functions
  27.  
  28. void GetSizes();
  29. void PrintMain(int& i);
  30. void ClientInfo(int startID, int endID);
  31. void GetName(char name[], int& exitName);
  32. void GetAddress(char number[], char street[], char neighborhood[], char city[]);
  33. void ClientTransactions(int id, int startID, int endID);
  34. void EditInfo();
  35. void ClientsInCities();
  36. void PrintBalanceOf();
  37. void PrintAllBalances();
  38. void PrintGreatestBalance();
  39.  
  40. // Supplementary Functions
  41.  
  42. int CheckString(char variable[], int MIN, int MAX);
  43. int isNumeric(char variable[]);
  44. int FindClient(char name[]);
  45. int FindCity(char city[]);
  46. int CharToInt(char variable[]);
  47. void EditTransactions(int id);
  48. void SetFormat(char variable[]);
  49. void CalculateBalance(int id, char transaction, int amount);
  50.  
  51. // End of Function Prototypes
  52. /////////////////////////////////////////////////////////////
  53.  
  54. struct Clients
  55. {
  56.     int tAmounts[TRANSACTIONS];
  57.     int balance;
  58.     int lastTransaction;
  59.     char name[MAX_NAME];
  60.     char number[MAX_ADDRESS / 4];
  61.     char street[MAX_ADDRESS];
  62.     char neighborhood[MAX_ADDRESS];
  63.     char city[MAX_ADDRESS];
  64.     char tTypes[TRANSACTIONS];
  65. };
  66.  
  67. Clients client[CLIENTS];
  68.  
  69. int main()
  70. {
  71.     char preCHOICE[MAX_ADDRESS];
  72.     int choice, i, exit = 0;
  73.     GetSizes();
  74.     ClientInfo(0, userMaxClients);
  75.     PrintMain(i);
  76.     while (true)
  77.     {
  78.         cin.getline(preCHOICE, MAX_ADDRESS);
  79.         if (CharToInt(preCHOICE) != -1)
  80.         {
  81.             choice = CharToInt(preCHOICE);
  82.             if (choice > 5 + i) cout<<"\nInvalid choice, please try again." << endl;
  83.             else {
  84.                 switch (choice)
  85.                 {
  86.                 case 0: {exit = 1; break; }
  87.                 case 1: {PrintAllBalances(); break; }
  88.                 case 2: {PrintBalanceOf(); break; }
  89.                 case 3: {PrintGreatestBalance(); break; }
  90.                 case 4: {EditInfo(); break; }
  91.                 case 5: {ClientsInCities(); break; }
  92.                 case 6: {ClientInfo(lastClient, userMaxClients); break; }
  93.                 default: {break; }
  94.                 }
  95.                 if (exit == 1)
  96.                 {
  97.                     cout<<"\nThank you for using our system!" << endl;
  98.                     break;
  99.                 }
  100.                 PrintMain(i);
  101.             }
  102.         }
  103.         else cout<<"\nPlease enter a positive integer number" << endl;
  104.  
  105.     }
  106.  
  107.  
  108.     return 0;
  109. }
  110.  
  111. /////////////////////////////////////////////////////////////
  112. // Start of Function Definitions
  113.  
  114. void GetSizes()
  115. {
  116.     char preCLIENTS[MAX_ADDRESS], preTRANSACTIONS[MAX_ADDRESS];
  117.     while (true) {
  118.         cout<<"How Many Clients Would You Like To Add?" << endl;
  119.         cin.getline(preCLIENTS, MAX_ADDRESS);
  120.         if (CharToInt(preCLIENTS) != -1)
  121.         {
  122.             userMaxClients = CharToInt(preCLIENTS);
  123.             if (userMaxClients > CLIENTS) {
  124.                 cout<<"\nCan't add more than " << CLIENTS << " clients." << endl;
  125.                 continue;
  126.             }
  127.             break;
  128.         }
  129.         else cout<<"\nPlease enter a positive integer number" << endl;
  130.     }
  131.     while (true) {
  132.         cout<<"\nHow Many Transactions Would You Like To Add?" << endl;
  133.         cin.getline(preTRANSACTIONS, MAX_ADDRESS);
  134.         if (CharToInt(preTRANSACTIONS) != -1)
  135.         {
  136.             userMaxTransactions = CharToInt(preTRANSACTIONS);
  137.             if (userMaxTransactions > TRANSACTIONS) {
  138.                 cout<<"\nCan't add more than " << TRANSACTIONS << " transactions." << endl;
  139.                 continue;
  140.             }
  141.             break;
  142.         }
  143.         else cout<<"\nPlease enter a positive integer number" << endl;
  144.     }
  145. }
  146.  
  147. void PrintMain(int& i)
  148. {
  149.     cout<<"\nWelcome To Bank Management System" << endl << endl;
  150.     cout<<"(0) Exit" << endl;
  151.     cout<<"(1) Print All Balances" << endl;
  152.     cout<<"(2) Print Customer's Balance" << endl;
  153.     cout<<"(3) Print Highest Balance" << endl;
  154.     cout<<"(4) Change Customer's Info" << endl;
  155.     cout<<"(5) Print Numbers of Clients in Cities" << endl;
  156.     if (lastClient < userMaxClients) {
  157.         i = 1;
  158.         cout<<"(6) Add " << userMaxClients - lastClient << " new clients" << endl;
  159.     }
  160.     else i = 0;
  161.     cout<<"\nEnter the number for your choice: ";
  162. }
  163.  
  164. void ClientInfo(int startID, int endID)
  165. {
  166.     int exitName = 0;
  167.     for (int i = startID; i < endID; i++) {
  168.         cout<<"\nPlease Enter Client " << i + 1 << "'s Name:" << endl;
  169.         GetName(client[i].name, exitName);
  170.         if (exitName == 1) break;
  171.         cout<<"\nPlease Enter Their Address\n(Number, Street, Neighborhood, City)" << endl;
  172.         GetAddress(client[i].number, client[i].street, client[i].neighborhood, client[i].city);
  173.         cout<<"\nPlease Enter Their Transactions In The Following Format" << endl;
  174.         cout<<"\n( W for Withdraw / D for Deposit ) (Numerical Amount)" << endl;
  175.         cout<<"\n(Maximum " << userMaxTransactions << " Transactions)" << endl;
  176.         cout<<"\n(Enter '" << BREAK << " 0' to stop)" << endl;
  177.         client[i].balance = BASEBALANCE;
  178.         ClientTransactions(i, 0, userMaxTransactions);
  179.         cin.ignore();
  180.         lastClient++;
  181.     }
  182. }
  183.  
  184. void GetName(char name[], int& exitName)
  185. {
  186.     if (lastClient > 0) cout<<"\n(Enter '" << BREAK << "' To Stop)" << endl;
  187.     exitName = 0;
  188.     cin.getline(name, MAX_NAME);
  189.     if (CheckString(name, MIN_NAME, MAX_NAME) == 0) {
  190.         cout<<"\nInvalid or too short name, please try again." << endl;
  191.         GetName(name, exitName);
  192.     }
  193.     else if (CheckString(name, MIN_NAME, MAX_NAME) == 2) {
  194.         if (lastClient < 1) {
  195.             cout<<"\nPlease enter info of at least 1 customer" << endl;
  196.             GetName(name, exitName);
  197.         }
  198.         else exitName = 1;
  199.     }
  200.     else SetFormat(name);
  201. }
  202.  
  203. void GetAddress(char number[], char street[], char neighborhood[], char city[])
  204. {
  205.     cin.getline(number, MAX_ADDRESS / 4, ',');
  206.     cin.getline(street, MAX_ADDRESS, ',');
  207.     cin.getline(neighborhood, MAX_ADDRESS, ',');
  208.     cin.getline(city, MAX_ADDRESS);
  209.     if (isNumeric(number) == 0 ||
  210.         CheckString(street, MIN_ADDRESS, MAX_ADDRESS) == 0 ||
  211.         CheckString(neighborhood, MIN_ADDRESS, MAX_ADDRESS) == 0 ||
  212.         CheckString(city, MIN_ADDRESS, MAX_ADDRESS) == 0)
  213.     {
  214.         cout<<"\nInvalid or too short address, please try again." << endl;
  215.         GetAddress(number, street, neighborhood, city);
  216.     }
  217.     else {
  218.         SetFormat(street);
  219.         SetFormat(neighborhood);
  220.         SetFormat(city);
  221.  
  222.         // Count numbers of clients in cities
  223.         int matching = 1;
  224.         for (int i = 0; i < userMaxClients; i++)
  225.         {
  226.             matching = 1; // The cities are matching by default
  227.             for (int j = 0; city[j] != '\0'; j++)
  228.             {
  229.                 if (city[j] != cities[i][j]) { matching = 0; break; } // A difference in one character makes them not-matching
  230.             }
  231.             if (matching == 1) { citiesCounts[FindCity(city)]++; break; } // If they end up matching, increase the count of city in cityCounts
  232.         }
  233.         static int id = 0;
  234.         if (matching == 0) // If they are not matching, store the city and initiliaze its count with 1
  235.         {
  236.             strcpy(cities[id], city);
  237.             citiesCounts[id] = 1;
  238.             id++;
  239.         }
  240.     }
  241. }
  242.  
  243. void ClientTransactions(int id, int startID, int endID)
  244. {
  245.     client[id].lastTransaction = 0;
  246.     for (int i = startID; i < endID; i++) {
  247.         cin>>client[id].tTypes[i]>>client[id].tAmounts[i];
  248.         if (client[id].tTypes[i] == BREAK && client[id].tAmounts[i] == 0) break;
  249.         else if ((client[id].tTypes[i] != 'W' && client[id].tTypes[i] != 'w'
  250.             && client[id].tTypes[i] != 'D' && client[id].tTypes[i] != 'd'
  251.             ) || client[id].tAmounts[i] <= 0) {
  252.             cout<<"\nInvalid transaction, please try again." << endl;
  253.             i--;
  254.             continue;
  255.         }
  256.         else {
  257.             if (client[id].tTypes[i] == 'W' || client[id].tTypes[i] == 'w') {
  258.                 if (client[id].balance >= client[id].tAmounts[i]) CalculateBalance(id, client[id].tTypes[i], client[id].tAmounts[i]);
  259.                 else {
  260.                     cout<<"\nInsufficient Balance For Transaction, Please Try Again." << endl;
  261.                     i--;
  262.                     continue;
  263.                 }
  264.             }
  265.             else CalculateBalance(id, client[id].tTypes[i], client[id].tAmounts[i]);
  266.             client[id].lastTransaction++;
  267.         }
  268.     }
  269. }
  270.  
  271. void EditInfo()
  272. {
  273.     char name[MAX_NAME], preCHOICE[MAX_TEMP];
  274.     int exitName, choice, id;
  275.     cout<<"\nWhose info would you like to edit?" << endl;
  276.     cout<<"\nAvailable clients:"<<endl;
  277.     for(int i = 0; i<lastClient; i++) cout<<'-'<<client[i].name<<endl;
  278.     cout<<endl;
  279.     while (true)
  280.     {
  281.         GetName(name, exitName);
  282.         id = FindClient(name);
  283.         if (id != -1 || exitName == 1) break;
  284.         else cout<<"\nClient not found, please try again." << endl;
  285.     }
  286.     if (exitName != 1)
  287.     {
  288.         cout<<"\nChange " << name << "'s Info" << endl;
  289.         while (true)
  290.         {
  291.             cout<<"\n(0) Exit" << endl;
  292.             cout<<"(1) Name" << endl;
  293.             cout<<"(2) Address" << endl;
  294.             cout<<"(3) Transactions" << endl;
  295.             cout<<"(4) Balance" << endl;
  296.             cout<<"\nEnter the number of your choice:" << endl;
  297.             cin.getline(preCHOICE, MAX_TEMP);
  298.             if (CharToInt(preCHOICE) != -1) {
  299.                 choice = CharToInt(preCHOICE);
  300.                 if (choice < 0 || choice > 4) cout<<"\nInvalid choice, please try again." << endl;
  301.                 else if (choice >= 1 && choice <= 4)
  302.                 {
  303.                     switch (choice) {
  304.                     case 1: {
  305.                         cout<<"\nPlease enter client's new name:" << endl;
  306.                         GetName(client[id].name, exitName);
  307.                         if (exitName != 1) cout<<"\nClient's current name is " << client[id].name << endl;
  308.                         else { cout<<"\nClient's name not changed" << endl; strcpy(client[id].name, name); }
  309.                         break;
  310.                     }
  311.                     case 2: {
  312.                         cout<<"\nPlease enter " << client[id].name << "'s new address:" << endl;
  313.                         GetAddress(client[id].number, client[id].street, client[id].neighborhood, client[id].city);
  314.                         cout<<"\nClient's current address is:" << endl;
  315.                         cout<<endl << client[id].number << ", " << client[id].street << ", " << client[id].neighborhood << ", " << client[id].city << endl;
  316.                         break;
  317.                     }
  318.                     case 3: {
  319.                         EditTransactions(id);
  320.                         break;
  321.                     }
  322.                     case 4: {
  323.                         cout<<"\nPlease enter " << client[id].name << "'s new balance: " << endl;
  324.                         char preBALANCE[MAX_TEMP];
  325.                         while (true) {
  326.                             cin.getline(preBALANCE, MAX_TEMP);
  327.                             if(CharToInt(preBALANCE) != -1){
  328.                                 client[id].balance = CharToInt(preBALANCE);
  329.                                 cout<<endl << client[id].name << "'s current balance is " << client[id].balance << endl;
  330.                                 client[id].lastTransaction = 0;
  331.                                 cout<<"\nAll transactions were reset" << endl;
  332.                                 break;
  333.                             }else cout<<"\nPlease enter a positive integer number" << endl;
  334.                         }
  335.                         break;
  336.                     }
  337.                     default: {break; }
  338.                     }
  339.                 }
  340.                 else break;
  341.             }
  342.             else cout<<"\nPlease enter a positive integer number" << endl;
  343.         }
  344.     }
  345. }
  346.  
  347. void ClientsInCities()
  348. {
  349.     char tempCHOICE[MAX_TEMP];
  350.     while(true){
  351.         cout<<"\n(0) Exit"<<endl;
  352.         cout<<"(1) Numbers of clients in all cities"<<endl;
  353.         cout<<"(2) Numbers of clients in a specific city"<<endl;
  354.         cin.getline(tempCHOICE, MAX_TEMP, '\n');
  355.         if(CharToInt(tempCHOICE) != -1){
  356.             int choice = CharToInt(tempCHOICE);
  357.             if(choice > 2) cout<<"\nInvalid choice, please try again"<<endl;
  358.             else{
  359.                 if(choice != 0){
  360.                     switch(choice)
  361.                     {
  362.                         case 1:{
  363.                             for (int i = 0; citiesCounts[i] != '\0'; i++)
  364.                             cout<<"\nThe number of clients from " << cities[i] << " is " << citiesCounts[i] << " clients"<<endl<<endl;
  365.                             break;
  366.                         }
  367.                         case 2:{
  368.                             cout<<"\nAvailable cities:"<<endl;
  369.                             for(int i = 0; cities[i][0] != '\0'; i++) cout<<cities[i]<<' ';
  370.                             cout<<"\n\nEnter a city's name: "<<endl;
  371.                             char city[MAX_ADDRESS];
  372.                             int id = -1;
  373.                             while(true)
  374.                             {
  375.                                 cin.getline(city, MAX_ADDRESS, '\n');
  376.                                 if(city[0] != BREAK)
  377.                                 {
  378.                                     SetFormat(city);
  379.                                     if(CheckString(city, MIN_ADDRESS, MAX_ADDRESS) == 0)
  380.                                     {
  381.                                         cout<<"\nInvalid city name, please try again.\n\n(Enter '"<<BREAK<<"' To Stop)"<<endl;
  382.                                     }else{
  383.                                         id = FindCity(city);
  384.                                         if(id == -1) cout<<"City Not Found"<<endl;
  385.                                         else cout<<"\nThe number of clients from " << cities[id] << " is " << citiesCounts[id] << " clients"<<endl;
  386.                                         break;
  387.                                     }
  388.                                 }else break;
  389.                             }
  390.                             break;
  391.                         }
  392.                     }
  393.                     break;
  394.                 }else break;
  395.             }
  396.  
  397.         }else cout<<"\nPlease enter a positive integer number"<<endl;
  398.         cout<<endl;
  399.     }
  400. }
  401.  
  402. void PrintBalanceOf()
  403. {
  404.     cout<<"\nWhose balance would you like to see?" << endl;
  405.     cout<<"\nAvailable clients:"<<endl;
  406.     for(int i = 0; i<lastClient; i++) cout<<'-'<<client[i].name<<endl;
  407.     cout<<endl;
  408.     cout<<"\n(Type '" << BREAK << "' To Stop)" << endl;
  409.     char name[MAX_NAME];
  410.     int id;
  411.     while (true) {
  412.         cin.getline(name, MAX_NAME, '\n');
  413.         if (name[0] != '.') {
  414.             SetFormat(name);
  415.             id = FindClient(name);
  416.             if (id == -1) {
  417.                 cout<<"\nClient Not Found. Please Try Again." << endl;
  418.                 cout<<"\n(Type '" << BREAK << "' To Stop)" << endl;
  419.             }
  420.             else {
  421.                 cout<<endl << client[id].name << "'s balance is " << client[id].balance << endl;
  422.                 break;
  423.             }
  424.         }
  425.         else break;
  426.     }
  427. }
  428.  
  429. void PrintAllBalances()
  430. {
  431.     cout<<endl << setw(MAX_NAME) << "Name" << setw(MAX_NAME) << "Balance" << endl;
  432.     for (int i = 0; i < lastClient; i++)
  433.     {
  434.         cout<<endl << setw(MAX_NAME) << client[i].name << setw(MAX_NAME) << client[i].balance << endl;
  435.     }
  436. }
  437.  
  438. void PrintGreatestBalance()
  439. {
  440.     int id = 0, maxBalance = client[id].balance;
  441.     for (int i = 0; i < lastClient; i++)
  442.     {
  443.         if (client[i].balance > maxBalance) {
  444.             maxBalance = client[i].balance;
  445.             id = i;
  446.         }
  447.     }
  448.     cout<<"\nThe greatest balance is " << client[id].name << "'s account with a balance of " << maxBalance << endl;
  449. }
  450.  
  451. int CheckString(char variable[], int MIN, int MAX)
  452. {
  453.     if (variable[0] == BREAK) return 2;
  454.     else {
  455.         int notFaulty = 1, correctSize = 1;
  456.         for (int i = 0; variable[i] != '\0'; i++)
  457.         {
  458.             bool notUpperCase = (variable[i] < 65 || variable[i] > 90);
  459.             bool notLowerCase = (variable[i] < 97 || variable[i] > 122);
  460.             bool notSpace = (variable[i] != ' ');
  461.             if (notLowerCase && notUpperCase && notSpace) {
  462.                 notFaulty = 0;
  463.                 break;
  464.             }
  465.         }
  466.         if (strlen(variable) < MIN || strlen(variable) > MAX) correctSize = 0;
  467.         return (notFaulty && correctSize);
  468.     }
  469. }
  470.  
  471. int isNumeric(char variable[])
  472. {
  473.     int numeric = 1;
  474.     for (int i = 0; variable[i] != '\0'; i++) {
  475.         if (variable[i] < 48 || variable[i] > 57) numeric = 0;
  476.     }
  477.     return numeric;
  478. }
  479.  
  480. int FindClient(char name[])
  481. {
  482.     int i = 0, found = 1;
  483.     while (i < lastClient)
  484.     {
  485.         found = 1;
  486.         for (int j = 0; j < strlen(name); j++) if (name[j] != client[i].name[j]) {
  487.             found = 0;
  488.             break;
  489.         }
  490.         if (found == 1) return i;
  491.         i++;
  492.     }
  493.     if (found == 0) return -1;
  494. }
  495.  
  496. int FindCity(char city[])
  497. {
  498.     int found = 1;
  499.     for (int i = 0; i < lastClient; i++)
  500.     {
  501.         found = 1;
  502.         for (int j = 0; j < strlen(city); j++) if (city[j] != cities[i][j]) {
  503.             found = 0;
  504.             break;
  505.         }
  506.         if (found == 1) return i;
  507.     }
  508.     if (found == 0) return -1;
  509. }
  510.  
  511. int CharToInt(char variable[])
  512. {
  513.     if (isNumeric(variable) == 0) return -1;
  514.     else
  515.     {
  516.         long int num = 0, length = strlen(variable);
  517.         for (int i = 0; i < length; i++)
  518.         {
  519.             num += (variable[i] - '0') * pow(10, (length - i - 1));
  520.         }
  521.         return num;
  522.     }
  523. }
  524.  
  525. void EditTransactions(int id)
  526. {
  527.     char preCHOICE[MAX_TEMP];
  528.     int choice, offset = 1, maximumChoice = client[id].lastTransaction + offset;
  529.     cout<<endl << client[id].name << "'s Transactions" << endl;
  530.  
  531.     cout<<"\n(0) Exit" << endl;
  532.     for (int i = 0; i < client[id].lastTransaction; i++)
  533.         cout<<'(' << i + 1 << ") " << client[id].tTypes[i] << ' ' << client[id].tAmounts[i] << endl;
  534.     cout<<'(' << client[id].lastTransaction + offset << ") Change All Transactions" << endl;
  535.     if (client[id].lastTransaction < userMaxTransactions) {
  536.         cout<<'(' << client[id].lastTransaction + (offset + 1) << ") Add New Transactions" << endl;
  537.         maximumChoice = client[id].lastTransaction + (offset + 1);
  538.     }
  539.     cout<<"\nEnter the number of your choice:" << endl;
  540.     while (true) {
  541.         cin.getline(preCHOICE, MAX_TEMP);
  542.         if (CharToInt(preCHOICE) != -1) {
  543.             choice = CharToInt(preCHOICE);
  544.             if (choice > maximumChoice) {
  545.                 cout<<"\nInvalid choice. Please try again." << endl;
  546.                 continue;
  547.             }
  548.             else {
  549.                 if (choice == 0) {
  550.                     cout<<"\nNo changes were made" << endl;
  551.                 }
  552.                 else if (choice == client[id].lastTransaction + offset) {
  553.                     cout<<"\nRe-Enter all transactions" << endl;
  554.                     cout<<"\n(Maximum " << userMaxTransactions << " Transactions)" << endl;
  555.                     ClientTransactions(id, 0, userMaxTransactions);
  556.                 }
  557.                 else if (choice == client[id].lastTransaction + (offset + 1)) {
  558.                     cout<<"\nEnter Transactions. Maximum " << userMaxTransactions - client[id].lastTransaction << " Transactions" << endl;
  559.                     ClientTransactions(id, client[id].lastTransaction, userMaxTransactions);
  560.                 }
  561.                 else {
  562.                     cout<<"\nEnter the new transaction:" << endl;
  563.                     if (client[id].tTypes[choice - 1] == 'W' || client[id].tTypes[choice - 1] == 'w') client[id].balance += client[id].tAmounts[choice - 1];
  564.                     else client[id].balance -= client[id].tAmounts[choice - 1];
  565.                     ClientTransactions(id, choice - 1, choice);
  566.                 }
  567.                 cout<<"\nClient's current balance is " << client[id].balance << endl;
  568.             }
  569.             break;
  570.         }
  571.         else cout<<"\nPlease enter a positive integer number" << endl;
  572.     }
  573. }
  574.  
  575. void SetFormat(char variable[])
  576. {
  577.     if (variable[0] == ' ')
  578.     {
  579.         for (int i = 0; i < strlen(variable); i++)
  580.         {
  581.             variable[i] = variable[i + 1];
  582.         }
  583.     }
  584.     int start = 0;
  585.     for (int i = 0; variable[i] != '\0'; i++) {
  586.         if (variable[start] >= 97 && variable[start] <= 122) variable[start] -= 32;
  587.         if (variable[i] != ' ') {
  588.             if (variable[i] >= 65 && variable[i] <= 90) variable[i] += 32;
  589.         }
  590.         else start = i + 1;
  591.     }
  592. }
  593.  
  594. void CalculateBalance(int id, char transaction, int amount)
  595. {
  596.     if (transaction == 'W' || transaction == 'w') client[id].balance -= amount;
  597.     else client[id].balance += amount;
  598. }
  599. // End of Function Definitions
  600. /////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement