Taking away integers

Hi there my code isnt working I basically want the user to enter a number and then I want to user to a second enter which i want the compiler to take it away from each other, i then want the result as an output message and then i want the sum to be taken away from a third number i want the user to enter and then i need a message to say which of the two is the lowest result I dont know if you can help me that it would be very much appreshiated!

Thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    cout << "Please Enter The first integer: ";
     cin >> numb1; 

     cout << "Please Enter The second integer: "; 
     cin >> numb2;  

	 sum = numb1 - numb2

	 cout << "Please Enter The third integer: "; 
     cin >> numb3; 

	 sum1= sum - numb3
	
	 
     cout << "The sum of taking away numb1 and numb2 is " << sum << endl;
	 cout << "The sum of taking away the result of numb1 and numb2 from numb3" << sum1 << endl;
Last edited on
1
2
3
4
5
6
7
8
if(sum < sum1)
{
   cout << "sum was lower" << endl;
}
else
{
   cout << "sum1 was lower or equal" << endl;
}
Thanks

where should I put the code, shall i take away anything?
Please, work on using punctuation such as the period. It was nearly impossible getting through that run-on sentence.

Now, as for the code, use a conditional to test which of the sums is greater than another.

1
2
3
4
5
6
7
8
9
10
if(sum < sum1)   //if the first sum is less than the second
{
    std::cout << "The lowest sum is: " << sum; //print the first sum
}else if(sum1 < sum)  //else if the second sum is smaller
{
    std::cout << "The lowest sum is: " << sum1; //print the second sum
}else     //accounts for the case that they're equal
{
    std::cout << "They're both equal at " << sum;
}



Edit: Got ninja'd :P.
Last edited on
Thanks alot very much appreshiated!
Topic archived. No new replies allowed.