a program stores sales amounts in two double variables named marySales and jimSa
ID: 3633048 • Letter: A
Question
a program stores sales amounts in two double variables named marySales and jimSales. Write the c++ code to assign the highest and lowest sales amounts to the highSales and lowSales variables, respectively and then display the contents of those variables. (You can assume that both sales amounts are different).This is where I got and could not get it.
<code>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare variables
double marySales;
double jimSales;
//Get inputs
cout << "Enter low sales: ";
cin >> low Sales;
cout << "Enter high Sales: ";
cin >> low sales;
//Calculate the raise amount
if ((marySales== 'low Sales') || (jimSales== 'high Sales'))
//end of if
system("pause");
return 0;
} //end of main function
<code>
Explanation / Answer
please rate - thanks
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare variables
double marySales;
double jimSales;
double highSales,lowSales;
//Get inputs
cout << "Enter Marys sales: ";
cin >> marySales;
cout << "Enter Jims Sales: ";
cin >> jimSales;
//Calculate the raise amount
if (marySales>jimSales)
{highSales=marySales;
lowSales=jimSales;
}
else
{highSales=jimSales;
lowSales=marySales;
}
//end of if
cout<<"High Sales: "<<highSales<<endl;
cout<<"Low Sales: "<<lowSales<<endl;
system("pause");
return 0;
} //end of main function
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.