Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string>
  6. #include <time.h>
  7. #include <windows.h>
  8. #include <conio.h>
  9. #include "klasa_1.h"
  10. #include "parzyste.h"
  11. #include "r_kwadratowe.h"
  12.  
  13. using namespace std;
  14.  
  15. int choice;
  16. char ctcp; //choice to close program
  17. void Wybor() //Menu programu
  18. {
  19.     cout<<"1. Kalkulator \n";
  20.     cout<<"2. Ilosc parzystych na N liczb \n";
  21.     cout<<"3. Rownanie kwadratowe \n";
  22.     cout<<endl<<"Wybor: ";
  23.     cin>>choice;
  24.     cout<<endl;
  25. }
  26. void wProgram()
  27. {
  28.     cout<<"Czy chcesz wylaczyc program? Jesli tak wpisz (T lub t), jednak jezeli chcesz chcesz wylaczyc wpisz (N lub n)"<<endl;
  29.     cout<<"Wybor: ";
  30.     ctcp = getch();
  31.     if(ctcp == 'T' || ctcp == 't')
  32.     {
  33.         cout<<endl<<endl<<"Trwa wylaczanie programu";
  34.         Sleep(2000);
  35.         exit(0);
  36.     }
  37.     else if(ctcp == 'N' || ctcp == 'n')
  38.     {
  39.         system("cls");
  40.     }
  41.     else exit(0);
  42. }
  43.  
  44. int main()
  45. {
  46.     Wybor();
  47.  
  48.     Kalkulator k1(1,1,2,0);
  49.     Parzyste p1(1,1);
  50.     rKwadratowe rk1(1,1,1,1,1,1);
  51.  
  52.     if(choice == 1)
  53.     {
  54.         for(;;)
  55.         {
  56.             Kalkulator k1(1,1,2,0);
  57.             k1.kWyciagnij();
  58.             k1.kMenu();
  59.             k1.kOblicz();
  60.             k1.kPokazWynik();
  61.             getchar();getchar();
  62.  
  63.             wProgram();
  64.         }
  65.     }
  66.     else if(choice == 2)
  67.     {
  68.         for(;;)
  69.         {
  70.             p1.l_parzystych=0;
  71.             p1.pWyciagnijIlosc();
  72.             p1.pObliczIlosc();
  73.             p1.pPokazIlosc();
  74.             getchar();getchar();
  75.  
  76.             wProgram();
  77.         }
  78.     }
  79.     else if(choice == 3)
  80.     {
  81.         for(;;)
  82.         {
  83.             rk1.rkPodajLiczby();
  84.             rk1.rkOblicz();
  85.             rk1.rkWyswietl();
  86.             getchar();getchar();
  87.  
  88.             wProgram();
  89.         }
  90.     }
  91.     return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement