am new student to c++ and am taking this course , I faced a little problem solving
my assignment question ..
this is the question.....
to write a program that reads in 5 whole numbers and outputsw the sum of all the numbers
greater than zero , the sum of all the numbers that are less that zero and the sum of
all the numbers entered .
please help me .. and thank you

Recommended Answers

All 4 Replies

We require that you show some proof of effort before offering any significant help. Do you have a specific issue that you encountered when trying to answer the question?

i have prombler to slove my asigmnt question that is to aply data structure operation on arry of 6 so plzzzzzz help me to slove this question

"bourisly":

Please post the code you have so far. Once we see what you've done up to now, we can offer suggestions for how to edit the program so it does what you want.

Does your existing program accept input of the numbers and then output them? That way, you could confirm it is inputting the numbers properly, and that is already half the program.

"i have prombler to slove my asigmnt question that is to aply data structure operation on arry of 6 so plzzzzzz help me to slove this question"

"anamkiani":

You should start your own thread instead of hijacking somebody else's; it just confuses issues. And you haven't provided much information anyhow. When you do start your own thread, tell us more about the problem, let us know what you have done so far, and perhaps post your code. And make an effort to use proper English.

Something like this:

#include<iostream>

using namespace std;
const int cnt=5;


int main ()
{
int k[cnt];
int sum=0;
for(int i=0; i<cnt; i++)
    {
    cin >> k[i];
    sum+=k[i];
    }
cout << "sum: " << sum << endl;
system ("PAUSE");
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.