Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <windows.h>
  4. #include <conio.h>
  5. #include <math.h>
  6. #include "getnum.h"
  7. #include "logo.h"
  8.  
  9. /* POLSKIE ZNAKI
  10.  
  11. ć - \206
  12. ł - \210
  13. ś - \230
  14. ó - \242
  15. ą - \245
  16. ę - \251
  17. ż - \253
  18. ź - \276
  19. ń - \344
  20. Ć - \217
  21. Ł - \235
  22. Ś - \227
  23. Ó - \340
  24. Ą - \244
  25. Ę - \250
  26. Ż - \275
  27. Ź - \215
  28. Ń - \343
  29.  
  30. KONIEC */
  31.  
  32. using namespace std;
  33.  
  34. void OglMat()
  35. {
  36.     bool Extra, ExtraLoop,AllLoop;
  37.     float UserPoints, MaxPoints, Procent;
  38.     do
  39.     {
  40.         cout<<endl;
  41.         UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
  42.         MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
  43.         if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
  44.         {
  45.             cout<<"Błędne dane!" <<endl;
  46.             AllLoop = true;
  47.         }
  48.         else
  49.         {
  50.             AllLoop = false;
  51.             if(UserPoints == MaxPoints)
  52.             {
  53.                 cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
  54.                 do
  55.                 {
  56.                     switch(getch())
  57.                     {
  58.                     case 't':
  59.                         Extra = true;
  60.                         ExtraLoop = false;
  61.                         break;
  62.                     case 'n':
  63.                         Extra = false;
  64.                         ExtraLoop = false;
  65.                         break;
  66.                     default:
  67.                         ExtraLoop = true;
  68.                         break;
  69.                     }
  70.                 }
  71.                 while(ExtraLoop);
  72.                 if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
  73.                 else cout<<"Otrzymana ocena: 5" <<endl;
  74.             }
  75.             else
  76.             {
  77.                 Procent = UserPoints / MaxPoints;
  78.                 Procent = round(Procent*100);
  79.                 cout<<"Otrzymana ocena: ";
  80.                 if(Procent<=39) cout<<"1." <<endl;
  81.                 else if(Procent>=40 && Procent<=55) cout<<"2." <<endl;
  82.                 else if(Procent>=56 && Procent<=75) cout<<"3." <<endl;
  83.                 else if(Procent>=76 && Procent<=89) cout<<"4." <<endl;
  84.                 else cout<<"5." <<endl;
  85.                 cout<<"Uzyskano " <<Procent <<"%." <<endl;
  86.             }
  87.             cout<<"0 - " <<round((39/MaxPoints)*100) <<" : 1" <<endl;
  88.             cout<<round((40/MaxPoints)*100) <<" - " <<round((55/MaxPoints)*100) <<" : 2" <<endl;
  89.             cout<<round((56/MaxPoints)*100) <<" - " <<round((75/MaxPoints)*100) <<" : 3" <<endl;
  90.             cout<<round((76/MaxPoints)*100) <<" - " <<round((89/MaxPoints)*100) <<" : 4" <<endl;
  91.             cout<<round((90/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
  92.             cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
  93.         }
  94.     }
  95.     while(AllLoop);
  96. }
  97.  
  98. void OglNmat()
  99. {
  100.     bool Extra, ExtraLoop,AllLoop;
  101.     float UserPoints, MaxPoints, Procent;
  102.     do
  103.     {
  104.         cout<<endl;
  105.         UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
  106.         MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
  107.         if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
  108.         {
  109.             cout<<"Błędne dane!" <<endl;
  110.             AllLoop = true;
  111.         }
  112.         else
  113.         {
  114.             AllLoop = false;
  115.             if(UserPoints == MaxPoints)
  116.             {
  117.                 cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
  118.                 do
  119.                 {
  120.                     switch(getch())
  121.                     {
  122.                     case 't':
  123.                         Extra = true;
  124.                         ExtraLoop = false;
  125.                         break;
  126.                     case 'n':
  127.                         Extra = false;
  128.                         ExtraLoop = false;
  129.                         break;
  130.                     default:
  131.                         ExtraLoop = true;
  132.                         break;
  133.                     }
  134.                 }
  135.                 while(ExtraLoop);
  136.                 if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
  137.                 else cout<<"Otrzymana ocena: 5" <<endl;
  138.             }
  139.             else
  140.             {
  141.                 Procent = UserPoints / MaxPoints;
  142.                 Procent = round(Procent*100);
  143.                 cout<<"Otrzymana ocena: ";
  144.                 if(Procent<=34) cout<<"1." <<endl;
  145.                 else if(Procent>=35 && Procent<=49) cout<<"2." <<endl;
  146.                 else if(Procent>=50 && Procent<=69) cout<<"3." <<endl;
  147.                 else if(Procent>=70 && Procent<=89) cout<<"4." <<endl;
  148.                 else cout<<"5." <<endl;
  149.                 cout<<"Uzyskano " <<Procent <<"%." <<endl;
  150.             }
  151.             cout<<"0 - " <<round((34/MaxPoints)*100) <<" : 1" <<endl;
  152.             cout<<round((35/MaxPoints)*100) <<" - " <<round((49/MaxPoints)*100) <<" : 2" <<endl;
  153.             cout<<round((50/MaxPoints)*100) <<" - " <<round((69/MaxPoints)*100) <<" : 3" <<endl;
  154.             cout<<round((70/MaxPoints)*100) <<" - " <<round((89/MaxPoints)*100) <<" : 4" <<endl;
  155.             cout<<round((90/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
  156.             cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
  157.         }
  158.     }
  159.     while(AllLoop);
  160. }
  161.  
  162. void ZawTeo()
  163. {
  164.     bool Extra, ExtraLoop,AllLoop;
  165.     float UserPoints, MaxPoints, Procent;
  166.     do
  167.     {
  168.         cout<<endl;
  169.         UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
  170.         MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
  171.         if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
  172.         {
  173.             cout<<"Błędne dane!" <<endl;
  174.             AllLoop = true;
  175.         }
  176.         else
  177.         {
  178.             AllLoop = false;
  179.             Procent = UserPoints / MaxPoints;
  180.             Procent = round(Procent*100);
  181.             cout<<"Otrzymana ocena: ";
  182.             if(Procent<=49) cout<<"1." <<endl;
  183.             else if(Procent>=50 && Procent<=63) cout<<"2." <<endl;
  184.             else if(Procent>=64 && Procent<=74) cout<<"3." <<endl;
  185.             else if(Procent>=75 && Procent<=88) cout<<"4." <<endl;
  186.             else if(Procent>=89 && Procent<=95) cout<<"5." <<endl;
  187.             else if(Procent>=96) cout<<"6.";
  188.             cout<<"0 - " <<round((49/MaxPoints)*100) <<" : 1" <<endl;
  189.             cout<<round((50/MaxPoints)*100) <<" - " <<round((63/MaxPoints)*100) <<" : 2" <<endl;
  190.             cout<<round((64/MaxPoints)*100) <<" - " <<round((74/MaxPoints)*100) <<" : 3" <<endl;
  191.             cout<<round((75/MaxPoints)*100) <<" - " <<round((88/MaxPoints)*100) <<" : 4" <<endl;
  192.             cout<<round((89/MaxPoints)*100) <<" - " <<round((95/MaxPoints)*100) <<" : 5" <<endl;
  193.             cout<<round((96/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 6" <<endl;
  194.         }
  195.     }
  196.     while(AllLoop);
  197. }
  198.  
  199. void ZawPra()
  200. {
  201.     bool Extra, ExtraLoop,AllLoop;
  202.     float UserPoints, MaxPoints, Procent;
  203.     do
  204.     {
  205.         cout<<endl;
  206.         UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
  207.         MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
  208.         if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
  209.         {
  210.             cout<<"Błędne dane!" <<endl;
  211.             AllLoop = true;
  212.         }
  213.         else
  214.         {
  215.             AllLoop = false;
  216.             Procent = UserPoints / MaxPoints;
  217.             Procent = round(Procent*100);
  218.             cout<<"Otrzymana ocena: ";
  219.             if(Procent<=64) cout<<"1." <<endl;
  220.             else if(Procent>=65 && Procent<=72) cout<<"2." <<endl;
  221.             else if(Procent>=73 && Procent<=80) cout<<"3." <<endl;
  222.             else if(Procent>=81 && Procent<=88) cout<<"4." <<endl;
  223.             else if(Procent>=89 && Procent<=95) cout<<"5." <<endl;
  224.             else if(Procent>=96) cout<<"6.";
  225.             cout<<"0 - " <<round((64/MaxPoints)*100) <<" : 1" <<endl;
  226.             cout<<round((65/MaxPoints)*100) <<" - " <<round((72/MaxPoints)*100) <<" : 2" <<endl;
  227.             cout<<round((73/MaxPoints)*100) <<" - " <<round((80/MaxPoints)*100) <<" : 3" <<endl;
  228.             cout<<round((81/MaxPoints)*100) <<" - " <<round((88/MaxPoints)*100) <<" : 4" <<endl;
  229.             cout<<round((89/MaxPoints)*100) <<" - " <<round((95/MaxPoints)*100) <<" : 5" <<endl;
  230.             cout<<round((96/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 6" <<endl;
  231.         }
  232.     }
  233.     while(AllLoop);
  234. }
  235.  
  236. void Diag()
  237. {
  238.     bool Extra, ExtraLoop,AllLoop;
  239.     float UserPoints, MaxPoints, Procent;
  240.     do
  241.     {
  242.         cout<<endl;
  243.         UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
  244.         MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
  245.         if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
  246.         {
  247.             cout<<"Błędne dane!" <<endl;
  248.             AllLoop = true;
  249.         }
  250.         else
  251.         {
  252.             AllLoop = false;
  253.             if(UserPoints == MaxPoints)
  254.             {
  255.                 cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
  256.                 do
  257.                 {
  258.                     switch(getch())
  259.                     {
  260.                     case 't':
  261.                         Extra = true;
  262.                         ExtraLoop = false;
  263.                         break;
  264.                     case 'n':
  265.                         Extra = false;
  266.                         ExtraLoop = false;
  267.                         break;
  268.                     default:
  269.                         ExtraLoop = true;
  270.                         break;
  271.                     }
  272.                 }
  273.                 while(ExtraLoop);
  274.                 if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
  275.                 else cout<<"Otrzymana ocena: 5" <<endl;
  276.             }
  277.             else
  278.             {
  279.                 Procent = UserPoints / MaxPoints;
  280.                 Procent = round(Procent*100);
  281.                 cout<<"Otrzymana ocena: ";
  282.                 if(Procent<=49) cout<<"1." <<endl;
  283.                 else if(Procent>=50 && Procent<=64) cout<<"2." <<endl;
  284.                 else if(Procent>=65 && Procent<=79) cout<<"3." <<endl;
  285.                 else if(Procent>=80 && Procent<=93) cout<<"4." <<endl;
  286.                 else cout<<"5." <<endl;
  287.                 cout<<"Uzyskano " <<Procent <<"%." <<endl;
  288.             }
  289.             cout<<"0 - " <<round((49/MaxPoints)*100) <<" : 1" <<endl;
  290.             cout<<round((50/MaxPoints)*100) <<" - " <<round((64/MaxPoints)*100) <<" : 2" <<endl;
  291.             cout<<round((65/MaxPoints)*100) <<" - " <<round((79/MaxPoints)*100) <<" : 3" <<endl;
  292.             cout<<round((80/MaxPoints)*100) <<" - " <<round((93/MaxPoints)*100) <<" : 4" <<endl;
  293.             cout<<round((94/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
  294.             cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
  295.         }
  296.     }
  297.     while(AllLoop);
  298. }
  299. void Content()
  300. {
  301.     system("cls");
  302.     cout<<"Naciśnij ESC aby zakończyć pracę!" <<endl <<endl;
  303.     cout<<"Lista przedmiotów: " <<endl;
  304.     cout<<"1. Ogólny maturalny." <<endl;
  305.     cout<<"2. Ogólny niematuralny." <<endl;
  306.     cout<<"3. Zawodowy teoretyczny." <<endl;
  307.     cout<<"4. Zawodowy praktyczny."<<endl;
  308.     cout<<"5. Sprawdzian diagnozujący. " <<endl <<endl;
  309.     bool WorkMenu = true;
  310.     cout<<"Wybór [1/2/3/4/5/ESC]";
  311.     do
  312.     {
  313.         switch(getch())
  314.         {
  315.         case '1':
  316.             system("cls");
  317.             WorkMenu = false;
  318.             OglMat();
  319.             break;
  320.         case '2':
  321.             system("cls");
  322.             WorkMenu = false;
  323.             OglNmat();
  324.             break;
  325.         case '3':
  326.             system("cls");
  327.             WorkMenu = false;
  328.             ZawTeo();
  329.             break;
  330.         case '4':
  331.             system("cls");
  332.             WorkMenu = false;
  333.             ZawPra();
  334.             break;
  335.         case '5':
  336.             system("cls");
  337.             WorkMenu = false;
  338.             Diag();
  339.             break;
  340.         case 27:
  341.             Sleep(1000);
  342.             return;
  343.         default:
  344.             break;
  345.         }
  346.     }
  347.     while(WorkMenu);
  348.     cout<<endl <<"Kontynuować pracę? [t/n]";
  349. }
  350.  
  351. int main()
  352. {
  353.     logo();
  354.     setlocale(LC_ALL,"");
  355.     char ctitle[128] = {};
  356.     sprintf(ctitle,"JAK\244 OCEN\250 POWINIENEM DOSTA\217? - AUTOR: KACPER SKRZYPEK (C)");
  357.     SetConsoleTitle(ctitle);
  358.     HANDLE cOut = GetStdHandle(STD_OUTPUT_HANDLE);
  359.     SetConsoleTextAttribute(cOut,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  360.     /****/
  361.     bool Work = true;
  362.     while(1)
  363.     {
  364.         Content();
  365.         switch(getch())
  366.         {
  367.         case 't':
  368.             continue;
  369.             break;
  370.         case 'n':
  371.             Work = false;
  372.             Sleep(1000);
  373.             return 0;
  374.             break;
  375.         default:
  376.             break;
  377.         }
  378.     }
  379.     /****/
  380.     SetConsoleTextAttribute(cOut,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
  381.     return 0;
  382. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement