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";
}
}
Title | # Comments | Views | Activity |
---|---|---|---|
C++ get user from AD (VS6) | 7 | 49 | |
Fully specialized class template function | 21 | 118 | |
Setting nameservers after res_init fails doing res_query | 2 | 77 | |
I could not build boost code, | 10 | 55 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!