Question #47876
Write C++ program (if the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesm?
1
Expert's answer
2014-10-15T14:44:37-0400
#include <iostream>using namespace std;//The main functionint main(){   int a = 0;   int positivesum = 0;   int negativesum = 0;   while(1)   {      cout<<"Enter the number: “;      cin>>a;      if(a>0)      {         positivesum += a;      }      else      {         negativesum += a;      }        cout<<"Result: "<<sum<<endl;   }   //system("pause");return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS