fork download
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. struct Account
  6. {
  7. int userID;
  8. string username;
  9. string email;
  10. int cnic;
  11. double balance;
  12. };
  13. int startUserID = 10001;
  14. vector<Account> accounts;
  15.  
  16. void accountCreation(){
  17. Account newAccount;
  18.  
  19. cout<<"======Account Creation======"<<endl;
  20. cout<<"Enter Full Name: ";
  21. getline(cin, newAccount.username);
  22.  
  23. cout<<"Enter Email: ";
  24. getline(cin, newAccount.email);
  25.  
  26. cout<<"Enter CNIC (without dashes): ";
  27. cin>>newAccount.cnic;
  28.  
  29. cout<<"Enter initial Balance: ";
  30. cin>>newAccount.balance;
  31. newAccount.userID = startUserID++;
  32.  
  33. cout<<"Congrats! Account Created Successfully!"<<endl
  34. <<"Your userID is: "<<newAccount.userID<<endl;
  35.  
  36. accounts.push_back(newAccount);
  37.  
  38. }
  39.  
  40. void showAccounts(){
  41. cout<<"======All Accounts======"<<endl;
  42. for(int i = 0; i<accounts.size(); i++){
  43. cout<<"UserID: "<<accounts[i].userID<<endl;
  44. cout<<"Name: "<<accounts[i].username<<endl;
  45. cout<<"Email: "<<accounts[i].email<<endl;
  46. cout<<"Balance: $"<<accounts[i].balance<<endl;
  47. cout<<"===============================";
  48. }
  49. }
  50.  
  51. int main(){
  52.  
  53. cout<<" _ __ ___ ____ _ _ _ __"<<endl;
  54. cout<<"| |\\ \\ / / | | _ \\ /\\ | \\ | | |/ /"<<endl;
  55. cout<<"| | \\ \\ / /| | | |_) | / \\ | \\| | ' / "<<endl;
  56. cout<<"| | \\ \\/ / | | | _ < / /\\ \\ | . ` | < "<<endl;
  57. cout<<"| |___\\ / | |____ | |_) / ____ \\| |\\ | . \\ "<<endl;
  58. cout<<"|______\\/ |______| |____/_/ \\_\\_| \\_|_|\\_\\"<<endl;
  59.  
  60.  
  61.  
  62. accountCreation();
  63. showAccounts();
  64.  
  65. }
  66.  
  67.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
 _ __      ___        ____          _   _ _  __
| |\ \    / / |      |  _ \   /\   | \ | | |/ /
| | \ \  / /| |      | |_) | /  \  |  \| | ' / 
| |  \ \/ / | |      |  _ < / /\ \ | . ` |  <  
| |___\  /  | |____  | |_) / ____ \| |\  | . \ 
|______\/   |______| |____/_/    \_\_| \_|_|\_\
======Account Creation======
Enter Full Name: Enter Email: Enter CNIC (without dashes): Enter initial Balance: Congrats! Account Created Successfully!
Your userID is: 10001
======All Accounts======
UserID: 10001
Name: 
Email: 
Balance: $1.15109e-310
===============================