Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <windows.h>
- #include <conio.h>
- #include <math.h>
- #include "getnum.h"
- #include "logo.h"
- /* POLSKIE ZNAKI
- ć - \206
- ł - \210
- ś - \230
- ó - \242
- ą - \245
- ę - \251
- ż - \253
- ź - \276
- ń - \344
- Ć - \217
- Ł - \235
- Ś - \227
- Ó - \340
- Ą - \244
- Ę - \250
- Ż - \275
- Ź - \215
- Ń - \343
- KONIEC */
- using namespace std;
- void OglMat()
- {
- bool Extra, ExtraLoop,AllLoop;
- float UserPoints, MaxPoints, Procent;
- do
- {
- cout<<endl;
- UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
- MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
- if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
- {
- cout<<"Błędne dane!" <<endl;
- AllLoop = true;
- }
- else
- {
- AllLoop = false;
- if(UserPoints == MaxPoints)
- {
- cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
- do
- {
- switch(getch())
- {
- case 't':
- Extra = true;
- ExtraLoop = false;
- break;
- case 'n':
- Extra = false;
- ExtraLoop = false;
- break;
- default:
- ExtraLoop = true;
- break;
- }
- }
- while(ExtraLoop);
- if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
- else cout<<"Otrzymana ocena: 5" <<endl;
- }
- else
- {
- Procent = UserPoints / MaxPoints;
- Procent = round(Procent*100);
- cout<<"Otrzymana ocena: ";
- if(Procent<=39) cout<<"1." <<endl;
- else if(Procent>=40 && Procent<=55) cout<<"2." <<endl;
- else if(Procent>=56 && Procent<=75) cout<<"3." <<endl;
- else if(Procent>=76 && Procent<=89) cout<<"4." <<endl;
- else cout<<"5." <<endl;
- cout<<"Uzyskano " <<Procent <<"%." <<endl;
- }
- cout<<"0 - " <<round((39/MaxPoints)*100) <<" : 1" <<endl;
- cout<<round((40/MaxPoints)*100) <<" - " <<round((55/MaxPoints)*100) <<" : 2" <<endl;
- cout<<round((56/MaxPoints)*100) <<" - " <<round((75/MaxPoints)*100) <<" : 3" <<endl;
- cout<<round((76/MaxPoints)*100) <<" - " <<round((89/MaxPoints)*100) <<" : 4" <<endl;
- cout<<round((90/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
- cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
- }
- }
- while(AllLoop);
- }
- void OglNmat()
- {
- bool Extra, ExtraLoop,AllLoop;
- float UserPoints, MaxPoints, Procent;
- do
- {
- cout<<endl;
- UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
- MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
- if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
- {
- cout<<"Błędne dane!" <<endl;
- AllLoop = true;
- }
- else
- {
- AllLoop = false;
- if(UserPoints == MaxPoints)
- {
- cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
- do
- {
- switch(getch())
- {
- case 't':
- Extra = true;
- ExtraLoop = false;
- break;
- case 'n':
- Extra = false;
- ExtraLoop = false;
- break;
- default:
- ExtraLoop = true;
- break;
- }
- }
- while(ExtraLoop);
- if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
- else cout<<"Otrzymana ocena: 5" <<endl;
- }
- else
- {
- Procent = UserPoints / MaxPoints;
- Procent = round(Procent*100);
- cout<<"Otrzymana ocena: ";
- if(Procent<=34) cout<<"1." <<endl;
- else if(Procent>=35 && Procent<=49) cout<<"2." <<endl;
- else if(Procent>=50 && Procent<=69) cout<<"3." <<endl;
- else if(Procent>=70 && Procent<=89) cout<<"4." <<endl;
- else cout<<"5." <<endl;
- cout<<"Uzyskano " <<Procent <<"%." <<endl;
- }
- cout<<"0 - " <<round((34/MaxPoints)*100) <<" : 1" <<endl;
- cout<<round((35/MaxPoints)*100) <<" - " <<round((49/MaxPoints)*100) <<" : 2" <<endl;
- cout<<round((50/MaxPoints)*100) <<" - " <<round((69/MaxPoints)*100) <<" : 3" <<endl;
- cout<<round((70/MaxPoints)*100) <<" - " <<round((89/MaxPoints)*100) <<" : 4" <<endl;
- cout<<round((90/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
- cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
- }
- }
- while(AllLoop);
- }
- void ZawTeo()
- {
- bool Extra, ExtraLoop,AllLoop;
- float UserPoints, MaxPoints, Procent;
- do
- {
- cout<<endl;
- UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
- MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
- if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
- {
- cout<<"Błędne dane!" <<endl;
- AllLoop = true;
- }
- else
- {
- AllLoop = false;
- Procent = UserPoints / MaxPoints;
- Procent = round(Procent*100);
- cout<<"Otrzymana ocena: ";
- if(Procent<=49) cout<<"1." <<endl;
- else if(Procent>=50 && Procent<=63) cout<<"2." <<endl;
- else if(Procent>=64 && Procent<=74) cout<<"3." <<endl;
- else if(Procent>=75 && Procent<=88) cout<<"4." <<endl;
- else if(Procent>=89 && Procent<=95) cout<<"5." <<endl;
- else if(Procent>=96) cout<<"6.";
- cout<<"0 - " <<round((49/MaxPoints)*100) <<" : 1" <<endl;
- cout<<round((50/MaxPoints)*100) <<" - " <<round((63/MaxPoints)*100) <<" : 2" <<endl;
- cout<<round((64/MaxPoints)*100) <<" - " <<round((74/MaxPoints)*100) <<" : 3" <<endl;
- cout<<round((75/MaxPoints)*100) <<" - " <<round((88/MaxPoints)*100) <<" : 4" <<endl;
- cout<<round((89/MaxPoints)*100) <<" - " <<round((95/MaxPoints)*100) <<" : 5" <<endl;
- cout<<round((96/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 6" <<endl;
- }
- }
- while(AllLoop);
- }
- void ZawPra()
- {
- bool Extra, ExtraLoop,AllLoop;
- float UserPoints, MaxPoints, Procent;
- do
- {
- cout<<endl;
- UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
- MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
- if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
- {
- cout<<"Błędne dane!" <<endl;
- AllLoop = true;
- }
- else
- {
- AllLoop = false;
- Procent = UserPoints / MaxPoints;
- Procent = round(Procent*100);
- cout<<"Otrzymana ocena: ";
- if(Procent<=64) cout<<"1." <<endl;
- else if(Procent>=65 && Procent<=72) cout<<"2." <<endl;
- else if(Procent>=73 && Procent<=80) cout<<"3." <<endl;
- else if(Procent>=81 && Procent<=88) cout<<"4." <<endl;
- else if(Procent>=89 && Procent<=95) cout<<"5." <<endl;
- else if(Procent>=96) cout<<"6.";
- cout<<"0 - " <<round((64/MaxPoints)*100) <<" : 1" <<endl;
- cout<<round((65/MaxPoints)*100) <<" - " <<round((72/MaxPoints)*100) <<" : 2" <<endl;
- cout<<round((73/MaxPoints)*100) <<" - " <<round((80/MaxPoints)*100) <<" : 3" <<endl;
- cout<<round((81/MaxPoints)*100) <<" - " <<round((88/MaxPoints)*100) <<" : 4" <<endl;
- cout<<round((89/MaxPoints)*100) <<" - " <<round((95/MaxPoints)*100) <<" : 5" <<endl;
- cout<<round((96/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 6" <<endl;
- }
- }
- while(AllLoop);
- }
- void Diag()
- {
- bool Extra, ExtraLoop,AllLoop;
- float UserPoints, MaxPoints, Procent;
- do
- {
- cout<<endl;
- UserPoints = get_float("Zdobyte punkty:","Błędne dane!");
- MaxPoints = get_float("Punkty do zdobycia:","Błędne dane!");
- if(UserPoints>MaxPoints || UserPoints<0 || MaxPoints<=0)
- {
- cout<<"Błędne dane!" <<endl;
- AllLoop = true;
- }
- else
- {
- AllLoop = false;
- if(UserPoints == MaxPoints)
- {
- cout<<"Wykonano zadanie dodatkowe? [t/n] " <<endl;
- do
- {
- switch(getch())
- {
- case 't':
- Extra = true;
- ExtraLoop = false;
- break;
- case 'n':
- Extra = false;
- ExtraLoop = false;
- break;
- default:
- ExtraLoop = true;
- break;
- }
- }
- while(ExtraLoop);
- if(Extra) cout<<"Otrzymana ocena: 6" <<endl;
- else cout<<"Otrzymana ocena: 5" <<endl;
- }
- else
- {
- Procent = UserPoints / MaxPoints;
- Procent = round(Procent*100);
- cout<<"Otrzymana ocena: ";
- if(Procent<=49) cout<<"1." <<endl;
- else if(Procent>=50 && Procent<=64) cout<<"2." <<endl;
- else if(Procent>=65 && Procent<=79) cout<<"3." <<endl;
- else if(Procent>=80 && Procent<=93) cout<<"4." <<endl;
- else cout<<"5." <<endl;
- cout<<"Uzyskano " <<Procent <<"%." <<endl;
- }
- cout<<"0 - " <<round((49/MaxPoints)*100) <<" : 1" <<endl;
- cout<<round((50/MaxPoints)*100) <<" - " <<round((64/MaxPoints)*100) <<" : 2" <<endl;
- cout<<round((65/MaxPoints)*100) <<" - " <<round((79/MaxPoints)*100) <<" : 3" <<endl;
- cout<<round((80/MaxPoints)*100) <<" - " <<round((93/MaxPoints)*100) <<" : 4" <<endl;
- cout<<round((94/MaxPoints)*100) <<" - " <<round((100/MaxPoints)*100) <<" : 5" <<endl;
- cout<<round((100/MaxPoints)*100) <<" + Zadanie dodatkowe : 6.";
- }
- }
- while(AllLoop);
- }
- void Content()
- {
- system("cls");
- cout<<"Naciśnij ESC aby zakończyć pracę!" <<endl <<endl;
- cout<<"Lista przedmiotów: " <<endl;
- cout<<"1. Ogólny maturalny." <<endl;
- cout<<"2. Ogólny niematuralny." <<endl;
- cout<<"3. Zawodowy teoretyczny." <<endl;
- cout<<"4. Zawodowy praktyczny."<<endl;
- cout<<"5. Sprawdzian diagnozujący. " <<endl <<endl;
- bool WorkMenu = true;
- cout<<"Wybór [1/2/3/4/5/ESC]";
- do
- {
- switch(getch())
- {
- case '1':
- system("cls");
- WorkMenu = false;
- OglMat();
- break;
- case '2':
- system("cls");
- WorkMenu = false;
- OglNmat();
- break;
- case '3':
- system("cls");
- WorkMenu = false;
- ZawTeo();
- break;
- case '4':
- system("cls");
- WorkMenu = false;
- ZawPra();
- break;
- case '5':
- system("cls");
- WorkMenu = false;
- Diag();
- break;
- case 27:
- Sleep(1000);
- return;
- default:
- break;
- }
- }
- while(WorkMenu);
- cout<<endl <<"Kontynuować pracę? [t/n]";
- }
- int main()
- {
- logo();
- setlocale(LC_ALL,"");
- char ctitle[128] = {};
- sprintf(ctitle,"JAK\244 OCEN\250 POWINIENEM DOSTA\217? - AUTOR: KACPER SKRZYPEK (C)");
- SetConsoleTitle(ctitle);
- HANDLE cOut = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(cOut,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- /****/
- bool Work = true;
- while(1)
- {
- Content();
- switch(getch())
- {
- case 't':
- continue;
- break;
- case 'n':
- Work = false;
- Sleep(1000);
- return 0;
- break;
- default:
- break;
- }
- }
- /****/
- SetConsoleTextAttribute(cOut,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement