pages:
  • 1
Mohammad Ghane SAYS

hi every body; I don't know why my code don't run properly. Is there any one who can help me? this is my code:

include

include

include

include

using namespace std;

int sitution(int cookiedir, int dir, int lastdir) { if(cookiedir - dir == 0) { cout << "Moving from " << lastdir << " to "<< dir << ":" << " found it!" << endl; return 0; } else if(sqrt( (cookiedir - lastdir) * (cookiedir - lastdir) ) > sqrt( (cookiedir - dir) * (cookiedir - dir) ) ) cout << "Moving from " << lastdir << " to " << dir << ": warmer." << endl; else if(sqrt( (cookiedir - lastdir) * (cookiedir - lastdir) ) == sqrt( (cookiedir - dir) * (cookiedir - dir) )) cout << "Moving from " << lastdir << " to " << dir << ": same." << endl; else cout << "Moving from " << last_dir << " to " << dir << ": colder." << endl; return 1; }

int main() { int cookiedir, dir, result, lastdir; cin >> cookiedir; if(cookiedir == 5280) { cin >> dir; return 0; } cin >> dir; lastdir = dir; while(cookiedir != 5280) { sitution(cookiedir,dir,0); result = 1; while (result != 0) { cin >> dir; result = sitution(cookiedir,dir,lastdir); lastdir = dir; } cin >> cookiedir; if( cookiedir != 5280) cout << endl; cin >> dir; last_dir = dir; } cin >> dir; }

AMiR SAYS

Can you use the code format to post your code? Or use http://scod.ir ?

In general, output limit exceeded is the judge's answer when your code produced too much output that the judge decided to terminate your program.

Bad reading from stdin or wrong loop parameters can cause this error.