Lee_assig8 - if (guess == random){ cout...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 //Cheu Lee #include <iostream> #include <ctime> using namespace std int main () { int random, guess srand (time(0)) random = rand() % 100 cout << "Pick a number between 0 and 99" << endl cin>> guess c if (guess == random) { cout << "Great! You guessed it right "<< random << endl } else { if (guess < random){ cout << "You guessed too low, please try again" << endl } if (guess > random){ cout << "You guessed too high, please try again" << endl } cin >> guess
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (guess == random){ cout &lt;&lt; &quot;Great, You guessed it right&quot; &lt;&lt; random &lt;&lt; endl } else { if (guess &gt; random) { cout&lt;&lt; &quot; You guessed too high please try again&quot; &lt;&lt; endl } if (guess &lt; random) { cout &lt;&lt; &quot;You guessed too low please try again &quot;&lt;&lt; endl } cin &gt;&gt; guess if (guess == random) { cout &lt;&lt; &quot;Great! You guessed it right&quot; &lt;&lt; endl } else { cout&lt;&lt; &quot;Sorry, you are out of luck today&quot; &lt;&lt; endl } } } return 0 }...
View Full Document

Ask a homework question - tutors are online