The cpp code that i wrote while solving an online solution, was running indefinitely, eventhough it was not supposed to. So i pinpointed the line that was causing the problem- it was the cin line.
I don’t know what is happening here, even the online compiler is showing timeout error in the code. this all started when i was practicing questions on codeforces and when i run it, it was running indefinitely.
he original code screenshot->the code that i typed on my machine, which was running indefinitely
#include<iostream>
using namespace std;
int main() {
int t;
cin >> t;
cout << "hello world, the value of t is = " << t << endl;
return 0;
}
the code in question->[the hello world code, in an online compiler showing timeout error](https://i.sstatic.net/53V7z7WH.png)
#include<iostream>
using namespace std;
int main() {
int t;
cin >> t;
cout << "hello world, the value of t is = " << t << endl;
return 0;
}
PLEASE give me some advice what to do…..
Akshat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.