Why I am getting garbage(unwanted) output here?
问题 Whenever I am writing this following code, I am getting garbage(unexpected) output in some online compiler, but if I use code block then getting satisfied output. So my question is why I am getting this type of output? for example, if I input 5 7 + 5 - 10 - 20 + 40 - 20 then I am getting 22 1 in the code block. But in the online compiler, it's something else. #include<iostream> #include<cstdlib> using namespace std; int main() { int have, n, i; int kid=0; cin>>n>>have; int line[n]; for(i=0;i