Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Marcin Motylski */
- /* Data: 17.10.2011 */
- /* Program obliczający wielkość wygranej */
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include <conio.h>
- #include <time.h>
- #include <Windows.h>
- using namespace std;
- int main() {
- // Zmienne
- int p;
- int q;
- int x;
- // Wejście <-----
- cout << "Podaj piewsza liczbe:";
- cin >> p;
- cout << "Podaj druga liczbe:";
- cin >> q;
- // Obliczenia
- if(p % 2 == 0 && q == 2 || q == 4 || q == 5)
- x = 1;
- else if(p % 2 == 0 && q == 1 || q == 3 || q == 6)
- x = 2;
- else if(p % 2 != 0 && q == 1 || q == 3 || q == 6) {
- if(p==q)
- x = 3;
- else
- x = 4;
- }
- else if(p % 2 != 0 && q == 2 || q == 4 || q == 5) {
- if(p == 5 && q == 5)
- x = 5;
- else
- x = 6;
- }
- else
- x = 7;
- switch(x) {
- case 1:{cout << "Twoja wygrana to: " << p+3*q;break;}
- case 2:{cout << "Twoja wygrana to: " << 2*q;break;}
- case 3:{cout << "Twoja wygrana to: " << 5*p+3;break;}
- case 4:{cout << "Twoja wygrana to: " << 2*q+p;break;}
- case 5:{cout << "Twoja wygrana to: " << min{p, q} + 4 + 5;break;}
- case 6:{cout << "Twoja wygrana to: " << min{p, q} + 4;break;}
- case 7:{cout << "Liczba musi miescic sie w zakresie <1, 6>";break;}
- }
- // Koniec
- do {
- system("cls");
- cout << "Powtorzyc ? (T/N)" << endl;
- } while(toupper(_getch()) == 'T');
- _getch();
- return 0;
- /*
- */
- }
Add Comment
Please, Sign In to add comment