Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
odluke_z5.cpp
00001 #include <iostream> 00002 #include <ctime> 00003 #include <cstdlib> 00004 00005 using namespace std; 00006 00007 int main (){ 00008 00009 int a = 0; 00010 int b = 9; 00011 int c=10; 00012 int rnd; 00013 srand((unsigned) time (NULL)); 00014 //cout << RAND_MAX; 00015 rnd = rand() % (b-a+1)+a; 00016 cout << rnd<< endl<<endl; 00017 while (c >= 10 || c < 0){ 00018 cout<<"Pogodi koji je broj od 0 do 9 zamislio ovaj kompjutor?" << endl; 00019 cin >> c; 00020 } 00021 00022 if (rnd == c){ 00023 cout<< "Pogodak"; 00024 } else if (abs(rnd-c) <=2){ 00025 cout<< "Blizu!"; 00026 } else { 00027 cout<< "Ni blizu!!"; 00028 } 00029 }
Generated on Thu Jul 14 2022 21:05:48 by
1.7.2