rider031

addingUsers

Jan 24th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cstdlib>
  4. #include <string>
  5. using namespace std;
  6. int setup();
  7. void selectMenu(string Users[],int UserNumbers);
  8. int Show(string array_1[], int numbers);
  9.  
  10.  
  11.  
  12. int add(int Us,string array_1[])
  13. {
  14.     Us++;
  15.     cout<<"Wpisz nazwe ";
  16.     cin>>array_1[Us -1];
  17.     return Us;
  18.  
  19. }
  20.  
  21. int setup()
  22. {
  23.     bool SetupDone = false;
  24.     int UserNumber;
  25.     if(SetupDone==false){
  26.         UserNumber = 1;
  27.         SetupDone = true;
  28.     }
  29.     bool IsActive = true;
  30.  
  31.  
  32.     return UserNumber;
  33. }
  34.  
  35. int main()
  36. {
  37.     char wybor;
  38.     int UserNumbers = setup();
  39.     string Users[UserNumbers];
  40.     Users[0] = "Ja";
  41.     cout<<"Users\n"<<endl;
  42.     Show(Users,UserNumbers);
  43.     selectMenu(Users,UserNumbers);
  44. return 0;
  45. }
  46.  
  47. int Show(string array_1[], int numbers)
  48. {
  49.     for(int i = 0; i < numbers ; i++)
  50.         {
  51.             cout<<"\n"<<i<<" "<<array_1[i];
  52.         }
  53. }
  54.  
  55. void selectMenu(string Users[],int UserNumbers)
  56. {
  57.     char wybor;
  58.     cout<<"\n\nWybierz akcje ";
  59.     cin>>wybor;
  60.     if(static_cast<int>(wybor) >= 48 && static_cast<int>(wybor) <= 57)
  61.         {
  62.             switch(static_cast<int>(wybor))
  63.             {
  64.             case(48):
  65.                UserNumbers = add(UserNumbers,Users);
  66.                 system("CLS");
  67.                 Show(Users,UserNumbers);
  68.                 selectMenu(Users,UserNumbers);
  69.  
  70.             }
  71.         }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment