I'm a beginner at C++, and I'm trying to write a simple application. However, I keep getting an error message that reads: "missing identifier ';' before 'random.' And 'expected a ';'.
These message seem to relate exclusively to the line that includes "random = rand ()%100+1" and the line directly below that reads "cout<< "Guess my number! (1-100) \n";"
I've been trying to figure this out for a while, now. I imagine it's a very simple solution; as most of the problems I've had have had simple solutions. Any help you can provide will be greatly appreciated.
Thanks.
#include <iostream>
#include <ctime>
using namespace std;
int main () {
int random;
int guess;
srand (static_cast <unsigned int>(time (0)))
random = rand()%100+1
cout<< "Guess my number! (1-100) \n";
while (guess != random)
{cin >> guess;}
cin.ignore ();
if (guess < random)
{cout<< "Too low... \n";}
if (guess > random)
{cout << "Too high. \n";}
if (guess == random)
{cout << "You won! My number was: " << random << "\n";}
cin.get ();