Error when an exe file is opened..(created with turbo c++)

The error has occured.... I wrote a c++ programme and saved it as an exe file..so that the code is executed directly when it is opened... but the following error was put on the screen....16 bit ms dos system...
ILLEGAL INSTRUCTIONS IGNORE or TERMINATE....If ignore is clicked..memory allocation error .... is displayed please help me sort this problem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdlib.h>
#include <iostream.h>
#include <conio.h>


int main()
{
srand( time(NULL) );
int number=rand()%100;
int
guess=-1;
int trycount=0;
while(guess!=number && trycount<8)

{
cout<<"Please enter a guess: ";
cin>>guess;

if(guess<number)
cout<<"Too low"<<endl;
if(guess>number) cout<<"Too high"<<endl;

trycount++;
}
if(guess==number)
cout<<"You guessed the number";
else
cout<<"Sorry, the number was:"<<number;
getch();
}
There should be a return value at the very end like:

1
2
3
4
...
getch();
return 0;
}


Did that fix it ?
Last edited on
Topic archived. No new replies allowed.