Hello i'm trying to get my program to work correctly.. the program is very simple all it does is caculate various basic math operations.. i have posted what it is suppose to do
Please enter two integer values separated by whitespace: 5 2
Here are the results:
5 plus 2 equals 7
5 minus 2 equals 3
5 multiplied by 2 equals 10
5 divided by 2 equals 2 with a remainder of 1
But with the second operand having a value of zero, we should see the following:

Please enter two integer values separated by whitespace: 5 0
Here are the results:
5 plus 0 equals 5
5 minus 0 equals 5
5 multiplied by 0 equals 0
Division by zero is undefined...

although my code something is wrong and still passing the zero to the function even though it's suppose to say "Division by zero is undefined..." i have posted my code below..

#include <iostream>using namespace std;void CalcIntResults(int value1, int value2, int &addition_total, int &minus_total, int &mulplication, int &division, int &reminder);int main(void){ int number1; int number2; int addition; int minus; int mulplication; int division; int reminder;cout <<"Please enter two integer values seperated by whitespace: ";cin >> number1 >>number2;CalcIntResults(number1, number2, addition, minus, mulplication, division, reminder);cout <<number1 <<" plus " <<number2 <<" equals " <<addition <<endl;cout <<number1 <<" minus "<<number2 <<" equal " <<minus <<endl;cout <<number1 <<" multiplied " <<number2 <<" equals " <<mulplication <<endl;if(number2!=0){cout <<number1 <<" divided " <<number2 <<" equals " <<division;}else { cout <<"Division by zero is undefined";}if((number1 % number2)!=0){ cout <<" reminder of " << reminder;}else { cout <<" no reminder";}}void CalcIntResults(int value1, int value2, int &addition_total, int &minus_total, int &mulplication, int &division, int &reminder){ addition_total = value1+value2; minus_total= value1-value2; mulplication= value1*value2; if(value2 !=0) { division = value1/value2; } else { cout <<"Division by zero is undefined"; }}

if that doesnt work (which it probably will) try this:

if(number2!="0")

the operators in c++ are extermely sensitive, and a char or string (as returned from stding) will not be cast to an int unless explicitly specified. another thing to try is

Complete code, just to make it easier: (sorry for spamming, my brain is on overload right now )

#include <iostream>using namespace std;void CalcIntResults(int value1, int value2, int &addition_total, int &minus_total, int &mulplication, int &division, int &reminder);int main(void){ int number1; int number2; int addition; int minus; int mulplication; int division; int reminder;cout <<"Please enter two integer values seperated by whitespace: ";cin >> number1 >>number2;CalcIntResults(number1, number2, addition, minus, mulplication, division, reminder);cout <<number1 <<" plus " <<number2 <<" equals " <<addition <<endl;cout <<number1 <<" minus "<<number2 <<" equal " <<minus <<endl;cout <<number1 <<" multiplied " <<number2 <<" equals " <<mulplication <<endl;if(number2!=0){ cout <<number1 <<" divided " <<number2 <<" equals " <<division; if((number1 % number2)!=0) { cout <<" reminder of " << reminder; } else { cout <<" no reminder"; }}else { cout <<"Division by zero is undefined";}}void CalcIntResults(int value1, int value2, int &addition_total, int &minus_total, int &mulplication, int &division, int &reminder){ addition_total = value1+value2; minus_total= value1-value2; mulplication= value1*value2; if(value2 !=0) { division = value1/value2; } else { cout <<"Division by zero is undefined"; }}

Introduction
This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net. To view more iPhone tutorials, visit www.sdkexpert.net.
This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…

The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…