1- the program will ask you to enter 2 numbers then it will find the ,aximum.
2- the program will ask you to enter 3 numbers and it will find the average of them.
3- the program will ask you to enter the number of quarters and halfs, then it will calculate the value in cents.
The average is equal to the sum of your numbers divided by the number of numbers.
ie: (c+d+e)/3.
Notice the dot after the three makes it a double, without it you would get an integer division.
cout<<"Enter First Number: "<<endl;
cin>>a;
cout<<"Enter Second Number: "<<endl;
cin>>b;
if (a>b)
{
cout<<"The Max Integer is: "<<a;
}
else
{
cout<<"The Max Integer is: "<<b;
}
int c, d, e, Avg=0;
cout<<"Enter 3 Numbers to find the Average on them"<<endl;
cin>>c>>d>>e;
cout<<"The Average is: "<<Avg=(c+d+e)/3<<endl<<endl;
is that correct? I have a problem, I use 2005 Express Edition which I'm not fully familiar with, when it should print the Avg value it just closes, it doesn't say " press any key to exit"
Here it is, help in correcting wrong lines, please..try and execute it pls
[
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, e, Avg=0;
cout<<"Enter First Number: ";
cin>>a;
cout<<"Enter Second Number: ";
cin>>b;
cout<<endl;
if (a>b)
{
cout<<"The Max Number is: "<<a<<endl;
}
else
{
cout<<"The Max Number is: "<<b<<endl<<endl;
}
cout<<endl<<endl<<endl;
cout<<"Enter 3 Numbers to find the Average on them"<<endl;
cin>>c>>d>>e;
Avg=(c+d+e)/3;
cout<<"The Average is: "<<Avg<<endl<<endl;
int q, h, cent;
cout<<"Enter Numer of quarters"<<endl;
cin>>q;
cout<<"Enter number of Halfs"<<endl;
cin>>h;
is that correct? I have a problem, I use 2005 Express Edition which I'm not fully familiar with, when it should print the Avg value it just closes, it doesn't say " press any key to exit"