Code showing error but properly running in eclipse

int m;

int sum = 0;
for (int i = 1;; i++)
{
cin >> m;

  sum = sum + m;
  if (sum < 0)
{
  break;
}
  else
{
  cout << m << endl;
}
}

There is not any error while submitting your code, pls try to submit your code again…

compilation error-

Compiling failed with exitcode 1, compiler output:
prog.cpp: In function ‘int main()’:
prog.cpp:6:1: error: ‘cin’ was not declared in this scope
cin>>m;
^~~
prog.cpp:6:1: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/7/iostream:60:18: note: ‘std::cin’
extern istream cin; /// Linked to standard input
^~~
prog.cpp:12:5: error: ‘cout’ was not declared in this scope
cout<<m<<endl;
^~~~
prog.cpp:12:5: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/7/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output

#include
using namespace std;
int main()
{
int m;

int sum = 0;
for (int i = 1;; i++)
{
cin >> m;

sum = sum + m;
if (sum < 0)
{
break;
}
else
{
cout << m << endl;
}
}
}

This is the complete code, pls submit this … I think you havent included the header files in your code while submitting…Pls make sure you do include all the header files…

You can see this, it is showing correct, when i submitted your code…

THANK YOU SO MUCH FOR YOU HELP!!


hi can you please check my code.The code is running fine and when i submitted , it said all testcases failed to run.

Is the code of revising quadratic equations ??

are you my TA? revising quadratic equation means

Yes, I am your TA… and i was asking the name of question for which you have send me the code … I was just confirming the name of question so that I could check the cases where your code is failing.

revising quadratic equations. fundamental challenges

I have edited your code, I have made some changes in your code, If you didnt understood anything, pls let me know.

hi mam. Thanks for the solution. In array 1.0 table , rainwater harvesting problem. I have thought upon a solution but it is not running can you please find out the problem in the given code.https://onlinegdb.com/HymnCNMk8

I would suggest you to mark the previous all doubts resolved and then make another doubt of rainwater harvesting problem and then send the code…