C++ PROGRAM. A publisher is offering an author three contract options. Please us
ID: 647047 • Letter: C
Question
C++ PROGRAM.
A publisher is offering an author three contract options. Please use file input and output.
Input: The input file has an unknown number of lines with the expected number of copies sold, and the expected selling price, starting on the second line of the file. The first line, which must be ignored, has labels on it. For example, the input file may contain:
Copies Sold Selling Price
4360 35.29
10500 20.99
50000 7.50
38500 104.00
Output: For each line of inputs, the output file the inputs used in the calculation, the amount paid to the author under each option, and the best option for the author. A sample output style could be:
For ________ copies sold at a price of $ _____________, the author is paid
$______________ under option 1
$______________ under option 2
$______________ under option 3
Option ___ is the best choice.
Explanation / Answer
//MFC Map
//manually entering data
int_tmain(int argc,INT* argv,INT* envp[])
{
else
{
CMapInttoInt m;
m["4360"]="35.29";
m["10500"]="20.99";
m["50000"]="7.50";
m["38500"]="104.00";
POSITION p;
p=m.GetStartPosition();
int copy,price;
cout<<"DISPLAY:"<<endl;
cout<<"Copies Sold Selling Price"
while(p!=null)
{
m.GetNextAssoc(p,copy,price);
cout<<(const int*)copy<<" "<<(const int*)price<<endl;
}
cout<<endl;
}
return nRetCode;
}
___________________________________________________________________
OUTPUT
___________________________________________________________________
Copies Sold Selling Price
copy=4360 price=35.29
copy=10500 price=20.99
copy=50000 price=7.50
copy=38500 price=104.00
______________________________________________________
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.