Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main(){
- setlocale(LC_ALL, "Lithuanian");
- int sk, spejimas, riba, spej, spejimai[10];
- spej = 0;
- cout << "Įveskite ribą: ";
- cin >> riba;
- sk = rand() % riba;
- cout << sk << endl;
- spejimas = -1;
- while (spejimas!=sk && spej<=4){
- cout << spej+1 <<" Spėjimas: Spėkite skaičių: ";
- cin >> spejimas;
- spejimai[spej] = spejimas;
- if (spejimas>sk){
- cout << "Spėjimas per didelis" << endl;
- }
- else{
- cout << "Spėjimas per mažas" << endl;
- }
- spej++;
- }
- if (spejimas==sk){
- cout << "" << endl;
- cout << "Atspėjote!" << endl;
- }
- else{
- cout << "" << endl;
- cout << "Per daug neteisingų spėjimų."<<endl;
- cout << "" << endl;
- }
- cout << "Jūsų spėjimai: ";
- int skaitliukas = 0;
- while (skaitliukas != spej){
- cout << spejimai[skaitliukas] << " ";
- skaitliukas++;
- }
- cout << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment