Advertisement
Guest User

coś złego

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