Zadatci sa slajdova

Revision:
0:ea32457dbd8b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/odluke_z5.cpp	Tue Nov 01 17:42:39 2016 +0000
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <ctime>
+#include <cstdlib>
+
+using namespace std;
+
+int main (){
+
+    int a = 0;
+    int b = 9;
+    int c=10;
+    int rnd;
+    srand((unsigned) time (NULL));
+    //cout << RAND_MAX;
+    rnd = rand() % (b-a+1)+a;
+    cout << rnd<< endl<<endl;
+    while (c >= 10 || c < 0){
+        cout<<"Pogodi koji je broj od 0 do 9 zamislio ovaj kompjutor?" << endl;
+        cin >> c;
+    }
+
+    if (rnd == c){
+        cout<< "Pogodak";
+    } else if (abs(rnd-c) <=2){
+        cout<< "Blizu!";
+    } else {
+        cout<< "Ni blizu!!";
+    }
+}