Hey guys, so I'm a beginner in C++ and I need some help. I'm using a website called hypergrade to turn in my programs, and one of my assignments was to create a program regarding plants, where it asks the user to input data such as weight, and how fast he/she would like to travel to the destined planet and it would output the result. My program compiled and it runs fine on microsoft visual 2010 express, however, when turning in my assignment on hypergrade, an error comes up:
E: empA1AB.tmpPlanets.cpp: In function 'int main()':E: empA1AB.tmpPlanets.cpp:100:20: warning: integer overflow in expressionI've asked my teacher for some help but knowing teachers, she never gave me a direct answer. All my variables are declared as a double, and here is my output result:cout << fixed << setprecision(2);
cout << "INTERPLANATERY TRAVEL: EARTH TO " << planetName << endl;
cout << "Your weight on " << planetName << ": " << weightNew << " lbs" << endl;
cout << "Your travel time to " << planetName << endl;
cout << "In hours: " << (travelHours) << endl;
cout << "In days: " << (travelDays) << endl;
cout << "In years: " << (travelYears) << endl;
//system("PAUSE");
return 0;
The reason why the system(pause) is in comments is because hypergrade doesn't recognize it, but just ignore that. As a result, this is what I get:
Picking D(for mars), entering 120 (weight) and 10 (miles per hour) i get in hours: 4800000
in days: 200000
in years: 547.95
apparently these numbers are too big for hypergrade, my teacher told me to use a UL code, but I have no idea how to use that and where to put it. Some help is much appreciated, thanks in advance