Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <cmath>
  5.  
  6. int main();
  7. int potegowanie();
  8. std::string login, password;
  9.  
  10. int adminpanel()
  11. {
  12.   printf("====[ADMIN_PANEL]====\n");
  13.   printf("testy");
  14. }
  15.  
  16. int dashboard()
  17. {
  18.   int choice;
  19.   if (login == "root")
  20.   {
  21.     printf("\nMenu:\n1.) Potegowanie\n2.) Wyjdz\n3.) Panel Administrator\n");  
  22.   }
  23.   else
  24.   {
  25.     printf("\nMenu:\n1.) Potegowanie\n2.) Wyjdz\n");
  26.   }
  27.   std::cin >> choice;
  28.   switch(choice)
  29.   {
  30.      case 1:
  31.         potegowanie(); break;
  32.      
  33.      case 2:
  34.         printf("See you soon! ;)"); break;
  35.      
  36.      if(login == "root")
  37.      {
  38.        case 3:
  39.        adminpanel(); break;
  40.      }
  41.   }
  42.  
  43.   return 0;
  44. }  
  45. double wynik;
  46. int poteguj(int pLiczba, int pPotega)
  47. {
  48.    wynik = pow(pLiczba, pPotega);
  49.    
  50.    return 0;
  51. }
  52. int potegowanie()
  53. {
  54.    int liczba, potega, choice;
  55.    printf("Wporwadz liczbe ktora chesz potegowac:\n");
  56.    std::cin >> liczba;
  57.    printf("Wprowadz potege:\n");
  58.    std::cin >> potega;
  59.    poteguj(liczba, potega);
  60.    std::cout << "Wynik: " << wynik << std::endl;
  61.    printf("\nCo checesz teraz zrobic?\n1.) Wróc do menu\n2.) Kolejne potegowanie\n");
  62.    std::cin >> choice;
  63.    switch(choice)
  64.    {
  65.      case 1:
  66.        dashboard(); break;
  67.      case 2:
  68.        potegowanie(); break;
  69.    }
  70.    
  71.    return 0;
  72. }
  73.  
  74. int main()
  75. {
  76.   std::string reglogin, regpassword;
  77.   std::string root = "root";
  78.   std::string hasloroot = "root";
  79.   std::string choicefirst;
  80.   printf("Witaj! Musisz sie zalogowac lub zarejestrowac.(logowanie, rejestracja)\n");
  81.   std::cin >> choicefirst;
  82.   if (choicefirst == "logowanie")
  83.   {
  84.     printf("Login: \n");
  85.     std::cin >> login;
  86.     printf("\nHaslo:\n");
  87.     std::cin >> password;
  88.     if (login == reglogin)
  89.     {
  90.       if (password == regpassword)
  91.       {
  92.        dashboard();
  93.       }
  94.     }
  95.     if (login == root)
  96.     {
  97.       if (password == hasloroot)
  98.       {
  99.        printf("Witaj ADMINISTRATORZE w programie!");
  100.        dashboard();
  101.       }
  102.     }
  103.     else
  104.     {
  105.       printf("Cos sie nie zgadza! Zresetuj program i sproboj jeszcze raz\n");
  106.     }
  107.  
  108.     return 0;
  109.   }
  110.   if (choicefirst == "rejestracja")
  111.   {
  112.     printf("Wprowadz login:\n");
  113.     std::cin >> reglogin;
  114.     printf("Wprowadz haslo:\n");
  115.     std::cin >> regpassword;
  116.     printf("\nCzas na twoje pierwsze logowanie!\nLogin:\n");
  117.     std::cin >> login;
  118.     printf("Haslo:\n");
  119.     std::cin >> password;
  120.     if (login == reglogin)
  121.     {
  122.        if (password == regpassword)
  123.        {
  124.         dashboard();
  125.        }
  126.     }
  127.     else
  128.     {
  129.      printf("Cos pomyliles! Zresetuj program");
  130.     }    
  131.   }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement