if(number2!='0')
#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(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";
}
#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";
}
}
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Fast, free, private online code repository / editor | 7 | 90 | |
Fully specialized class template function | 21 | 129 | |
How to split this in C++ | 4 | 93 | |
Eclipse IDE - Cannot copy/paste from console output | 8 | 126 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
15 Experts available now in Live!