Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- srand ( time (0));
- int sk1, sk2, darb, atzime=0;
- double rez;
- for ( int i = 1; i <= 10; i++)
- {sk1 = 1 + rand() % 9;
- sk2 = 1 + rand() % 9;
- darb = 1 + rand() % 4;
- {if (darb == 1) {cout << sk1 << " + " << sk2 << "=?"<<endl;
- cout << "Ievadiet rezultatu"<<endl;
- cin >> rez;
- if (rez == sk1+sk2) {cout << "Pareizi!"<<endl;
- atzime=atzime+1;}
- else {cout << "Nepareizi"<<endl;}}
- else if (darb == 2) {cout << sk1 << " - " << sk2 << "=?"<<endl;
- cout << "Ievadiet rezultatu"<<endl;
- cin >> rez;
- if (rez == sk1-sk2) {cout << "Pareizi!"<<endl;
- atzime=atzime+1;}
- else {cout << "Nepareizi"<<endl;}}
- else if (darb == 3) {cout << sk1 << " * " << sk2 << "=?"<<endl;
- cout << "Ievadiet rezultatu"<<endl;
- cin >> rez;
- if (rez == sk1*sk2) {cout << "Pareizi!"<<endl;
- atzime=atzime+1;}
- else {cout << "Nepareizi"<<endl;}}
- else if (darb == 4) {cout << sk1 << " / " << sk2 << "=?"<<endl;
- cout << "Ievadiet rezultatu"<<endl;
- cin >> rez;
- if (rez == sk1/sk2) {cout << "Pareizi!"<<endl;
- atzime=atzime+1;}
- else {cout << "Nepareizi"<<endl;}}}}
- cout << "Tava atzime ir " << atzime<<endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement