Advertisement
JuanTorres

Untitled

Jan 28th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.51 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include<iomanip>
  4.  
  5. using namespace std;
  6.  
  7. const int size = 2;
  8.  
  9. struct Persona
  10. {
  11.     string name;
  12.     string Address;
  13.     string city;   
  14.     int zip;
  15.     float AccBal;
  16.     string DatelastPayment;
  17.  
  18. };
  19.  
  20. void P_inf(Persona[], int);
  21.  
  22. int main()
  23. {
  24.     Persona inf[size];
  25.        
  26.     char opc;
  27.     int option;
  28.     int x;
  29.     char cha;
  30.  
  31.      P_inf(inf, size);
  32.  
  33.     do
  34.     {
  35.         cout << "Enter the account you want ? "; cin >> x;
  36.  
  37.         x = x - 1;
  38.        
  39.  
  40.         cout << "\t\t_______________________" << endl;
  41.         cout << "\t\tMenu " << endl;
  42.  
  43.         cout << "\t\t1)Name  \t 2)Addres" << endl;
  44.         cout << "\t\t3)City  \t 4)Zip Code " << endl;
  45.         cout << "\t\t5)AccountBalance 6)DatelastPayment" << endl << endl;
  46.                
  47.         cout << "Enter a option :"; cin >> option; cout << endl;
  48.        
  49.         switch (option)
  50.         {
  51.  
  52.         case 1:
  53.         {
  54.             cout << "Customer Name #" << " : " << inf[x].name << endl << endl;
  55.  
  56.             cout << "Do you want to change customer name ?(Y/N)"; cin >> cha; cout << endl;
  57.  
  58.             if (cha == 'y' || cha == 'Y')
  59.             {
  60.                 cout << "Customer name #";cin.ignore(); getline(cin, inf[x].name); cout << endl << endl;
  61.                 cout << "Customer name change ?" << inf[x].name << endl;
  62.             }
  63.             break;
  64.         }
  65.         case 2:
  66.         {      
  67.            
  68.             cout << "Address #" << inf[x].Address << endl << endl;
  69.  
  70.             cout << "You want change city ?(Y/N) "; cin >> cha; cout << endl;
  71.             if (cha == 'Y' || cha == 'y')
  72.             {
  73.                 cout << "Address :";cin.ignore(); getline(cin, inf[x].Address); cout << endl << endl;
  74.                 cout << "Address change :" << inf[x].Address; cout << endl;
  75.             }
  76.             break;
  77.         }
  78.         case 3:
  79.         {                      
  80.             cout << "City :" << inf[x].city << endl << endl;
  81.  
  82.             cout << "You want change city ?(Y/N) "; cin >> cha; cout << endl;
  83.  
  84.             if (cha == 'Y' || cha == 'y')
  85.             {
  86.                 cout << "City :";cin.ignore(); getline(cin, inf[x].city); cout << endl << endl;
  87.                 cout << "City change :" << inf[x].city; cout << endl;
  88.  
  89.  
  90.             }
  91.             break;
  92.         }
  93.         case 4:
  94.         {                      
  95.             cout << "Zip Code #" << inf[x].zip << endl << endl;
  96.        
  97.             cout << "Do you want to change Zip Code ?(Y/N)"; cin >> cha; cout << endl;
  98.  
  99.             if (cha == 'y' || cha == 'Y')
  100.             {                              
  101.                 cout << "Zip Code #"; cin >> inf[x].zip; cout << endl << endl;
  102.                 cout << "Zip Code change ?" << inf[x].zip << endl;
  103.             }          
  104.             break;
  105.         }
  106.         case 5:
  107.         {
  108.             cout << fixed << showpoint << setprecision(2);         
  109.             cout << "Account Balansce $" << inf[x].AccBal << endl << endl;
  110.            
  111.             cout << "Do you want to change Account Balance ?(Y/N)"; cin >> cha; cout << endl;
  112.  
  113.             if (cha == 'y' || cha == 'Y')
  114.             {              
  115.                     cout << "Account Balansce $"; cin >> inf[x].AccBal; cout << endl << endl;
  116.                     cout << "Account Balance change $" << inf[x].AccBal; cout << endl;             
  117.             }
  118.             break;
  119.         }
  120.         case 6:
  121.         {                      
  122.             cout << "Account Date last Balance : " << inf[x].DatelastPayment << endl << endl;
  123.            
  124.             cout << "Do you watn to change Account Balance ?(Y/N)"; cin >> cha; cout << endl;
  125.  
  126.             if (cha == 'Y' || cha == 'y')
  127.             {
  128.                 cout << "Account Date last Balance :"; cin >> inf[x].DatelastPayment; cout << endl << endl;
  129.                 cout << "Account Date last Balance change :" << inf[x].DatelastPayment; cout << endl;
  130.             }
  131.             break;
  132.         }
  133.         default:
  134.         {
  135.             cout << "Option not found !" << endl;
  136.             break;
  137.         }
  138.  
  139.     }cout << endl << endl;
  140.    
  141.         cout << "Do you want to continue ? "; cin >> opc;
  142.         cout << "_____________________________" << endl << endl;
  143.  
  144.     }while (opc == 'Y' || opc == 'y');
  145.  
  146.     cout << "-------------------------------------------------------------------------------" << endl;
  147.    
  148.     return 0;
  149. }
  150.  
  151. void P_inf(struct Persona p[], int size)
  152. {
  153.     cout << "\t\t\t*********************" << endl;
  154.     cout << "\t\t\tCustomer Account " << endl << endl; 
  155.    
  156.     for (int i = 0; i < size; i++)
  157.     {
  158.         cout << "Customer #" << (i + 1) << endl;
  159.  
  160.         cout << "________________________________" << endl;
  161.  
  162.         cout << "Customer Name #" << " : "; cin.ignore(); getline(cin, p[i].name); cout << endl;
  163.  
  164.         cout << "Address #"; getline(cin, p[i].Address);
  165.         cout << endl;
  166.  
  167.         cout << "City :"; getline(cin, p[i].city);
  168.         cout << endl;
  169.  
  170.         cout << "Zip Code #"; cin >> p[i].zip;
  171.         cout << endl;
  172.  
  173.         cout << "Account Date last Balance : ";cin.ignore();  getline(cin, p[i].DatelastPayment);
  174.         cout << endl;
  175.  
  176.         cout << "Account Balanse $"; cin >> p[i].AccBal; cout << endl;
  177.         while (p[i].AccBal < 0)
  178.         {
  179.             cout << "Incorrect Value !" << endl;
  180.             cout << "___________________________" << endl;
  181.             cout << "Account Balanse $"; cin >> p[i].AccBal; cout << endl;
  182.         }
  183.     }  
  184.     cout << "-------------------------------------------" << endl << endl; 
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement