Skip to content

Instantly share code, notes, and snippets.

@Phitherek
Created March 12, 2012 20:43
Show Gist options
  • Save Phitherek/2024571 to your computer and use it in GitHub Desktop.
Save Phitherek/2024571 to your computer and use it in GitHub Desktop.
Phitherek_' s Decider v. 0.1
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
srand(time(NULL));
cout << "Phitherek_' s Decider v. 0.1 (c) 2012 by Phitherek_" << endl;
char pt;
do {
cout << "Poziom trudności testu (l - Łatwy, s - Średni, t - Trudny, q - zakończ): ";
cin >> pt;
int p, d, t;
p = rand()%20+1;
d = rand()%20+1;
t = rand()%20+1;
cout << "Wyniki losowania: " << p << ", " << d << ", " << t << endl;
int sum = p+d+t;
cout << "Suma: " << sum << endl;
if(pt == 'l') {
cout << "Próg testu: 15" << endl;
if(sum >= 15) {
cout << "Wynik testu: pozytywny" << endl;
} else {
cout << "Wynik testu: negatywny" << endl;
}
} else if(pt == 's') {
cout << "Próg testu: 30" << endl;
if(sum >= 30) {
cout << "Wynik testu: pozytywny" << endl;
} else {
cout << "Wynik testu: negatywny" << endl;
}
} else if(pt == 't') {
cout << "Próg testu: 50" << endl;
if(sum >= 50) {
cout << "Wynik testu: pozytywny" << endl;
} else {
cout << "Wynik testu: negatywny" << endl;
}
} else if(pt == 'q') {
break;
} else {
cout << "Proszę wybrać jedną z opcji l/s/t/q!" << endl;
}
} while(pt != 'q');
cout << "Dziękuję za skorzystanie z Phitherek_' s Decider!" << endl;
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment