//Guess my Number (inverted)
//The computer will guess your number
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main ()
{
int myNumber;
char yorn;
cout <<"Enter a number between 1 and 10: ";
cin >> myNumber;
cout <<"\nYou chose "<<myNumber <<" as your number.";
srand(time(0));
do
{
int theNumber = rand() % 10 + 1;
cout <<"Is your number "<<theNumber<<"? (y/n)";
cin >> yorn;
} while ((yorn != 'y') || (yorn !='Y'));
cout <<"I won !";
return 0;
}
This is what it marks.
C:\Users\Guillermo\Desktop\C++\Learning\test.c|4|error: iostream: No such file or directory|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|5|error: cstdlib: No such file or directory|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|6|error: ctime: No such file or directory|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|8|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
C:\Users\Guillermo\Desktop\C++\Learning\test.c||In function 'main':|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|16|error: 'cout' undeclared (first use in this function)|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|16|error: (Each undeclared identifier is reported only once|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|16|error: for each function it appears in.)|
C:\Users\Guillermo\Desktop\C++\Learning\test.c|17|error: 'cin' undeclared (first use in this function)|
||=== Build finished: 8 errors, 0 warnings ===|