i want c++ to perform each and every some that i can think so i don't know where i have gone wrong

#include<iostream>
using namespace std;
int main()
{
    int x,y,z;
    cin>>x>>y>>z;
    cout<<"sum is"<<x,y,z<<endl;      
    return 0;
}

"sum" would imply adding. I see no addition operator (+) in your code. Hence no adding is done.

i got it but i want it to continue calculating other values without returning back

#include<iostream>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
cout<<"sum is"<<x*y*z<<endl;
return 0;
}

If you want to continue calculating other values, then you should continue calculating other values. What is preventing you from doing so?

That's a product (*), not a sum(+).

Set up an infinite (or non-infinite) loop. Stick what is to be repeated inside the loop.

while(1)
{
    cin>>x>>y>>z;
    cout<<"sum is"<<x+y+z<<endl; 
}
#include<iostream>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
cout<<"sum is"<<[B]x+y+z[/B]<<endl;
return 0;
}

simply...
if you need to create something that add more or less than 3 or various numbers of number simply use a while loop
here is something quick and nice

#include<iostream>
using namespace std;
int main()
{
int x,sum;
sum = 0;
while(x!=-1){
cout<<"please enter a number or -1 to get the result";
cin>>x;
sum+=x;
cout<<endl;
}
cout<<"sum is"<<sum<<endl;
return 0;
}

This code will simply prompt you to input numbers until you enter a -1 value, then the system will output the result of summation.

you mean like this,i don't want it like this because it does not have an end

#include<iostream>
using namespace std;
int main()
{
int x,y,z;
while(1)
cin>>x>>y>>z;
cout<<"sum is"<<x*y*z<<endl;
return 0;
}

Use code tags, not quote tags. You need the brackets. The while loop won't work without the brackets. If you don't want an infinite loop, you need an exit condition on the loop. saadsaidi gave an example that can get you started.

please help i want this program to stop when i enter 0 to all variables


#include<iostream>
using namespace std;
int main()
{
int x;
int y;
int z;
cin>>x>>y>>z;
cout<<"sum is ="<<x+y+z<<endl;
while (x !=0 && y!=0, z!=0)
{
int x,y,z;
cin>>x>>y>>z;
cout<<"sum is ="<<x+y+z<<endl;
}
return 0;
}

please help i want this program to stop when i enter 0 to all variables


#include<iostream>
using namespace std;
int main()
{
int x;
int y;
int z;
cin>>x>>y>>z;
cout<<"sum is ="<<x+y+z<<endl;
while (x !=0 && y!=0, z!=0)
{
int x,y,z;
cin>>x>>y>>z;
cout<<"sum is ="<<x+y+z<<endl;
}
return 0;
}

Line 15 - Delete this line. You already have x, y, and z declared. All line 15 does is complicate things with scoping issues.

Line 13 - The condition is that we stop if all three variables are zero. That's this:

(x == 0 && y == 0 && z == 0)

We stop when this is true. That means we continue when the above is false. That's the ! operator:

!(x == 0 && y == 0 && z == 0)

So line 13 needs to be this...

while(!(x == 0 && y == 0 && z == 0))

Clearly you are not stating what you want in a vivid way I'll suppose that you want to enter 3 number and the system will return the summation.and then prompt you again to enter 3 new number until you enter a 0 for each variable leading to an exit.
I hope the following help.

include<iostream>
using namespace std;
int main(){

int x,y,z;
while(1){
cin>>x>>y>>z;
if(x !=0 && y!=0 && z!=0)
cout<<"sum is ="<<($x+$y+$z)<<endl;
}else{
break;
}
}
return 0;
}

if this is not whats required please reply back with a clear objective and I'll be glad to help

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.