Fatal error?

4 replies [Last post]
JabMan1
Offline
Last seen: 9 years 3 weeks ago
Joined: 2010-05-28
bOt Points: 82

When I run this code (to Follow) I get this fatel error message the code sems simple enough why am I getting this or what am i doing wrong?

The code:
#nclude
using namespace std;

int main()
{
int x;

for(x=0; x<6; x++)
{
if(x==1)
cout <<" x is one " << endl;
else if(x==2)
cout << " x is two " << endl;
else if(x==3)
cout << " x is 3 " << endl;
else if(x==4)
cout << " x is 4 " << endl;
else
cout << " x is not between 1 and 4 " << endl;
}
return 0;
}
The Message:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292288 bytes) in /home/botskoco/public_html/checking.php on line 154

JabMan1
Offline
Last seen: 9 years 3 weeks ago
Joined: 2010-05-28
bOt Points: 82
Never mind I see the type

Never mind I see the type error.

JabMan1
Offline
Last seen: 9 years 3 weeks ago
Joined: 2010-05-28
bOt Points: 82
got the error again

Ok I thought I was getting that error because of a typeo BUT I got it again using this code.

#include
using namespace std;

int main()
{
int num;

do
{
cout << "Enter a number (100 to stop):";
cin >> num;
}
while(num != 100);
return 0;
}

WHY???

shashwat
Offline
Last seen: 1 year 11 weeks ago
Joined: 2009-02-18
bOt Points: 1160
Hi JabMan1, If your code

Hi JabMan1,

If your code takes more than 30 seconds to execute or goes into an infinite loop then you will get this error.

Founder and Admin

TathagatC
Offline
Last seen: 9 years 3 weeks ago
Joined: 2010-09-20
bOt Points: 54
Hi Jabman1

Hey, your code ran perfectly when we added a filename <iostream> in #include .

TatC