2.8
#include <iostream>
using namespace std;
int main()
{
cout << "2\12" << endl;
cout << "2\t\x4d\n" << endl;
}
2.41
#include <iostream>
#include <string>
#include "Sales_data.h"
using namespace std;
int main()
{
bool sign = true;
Sales_data q_20;
double price;
while (sign) {
cin >> q_20.bookNo >> q_20.units_sold >> price;
q_20.revenue = q_20.units_sold * price;
cout << q_20.bookNo << " " << q_20.units_sold << " " << q_20.revenue << endl;
cin >> sign;
}
Sales_data q_21_1, q_21_2;
cin >> q_21_1.bookNo >> q_21_1.units_sold >> price;
q_21_1.revenue = price*q_21_1.units_sold;
cin >> q_21_2.bookNo >> q_21_2.units_sold >> price;
q_21_2.revenue = price*q_21_2.units_sold;
if (q_21_1.bookNo == q_21_2.bookNo) {
cout << q_21_1.bookNo << " "
<< q_21_1.units_sold + q_21_2.units_sold << " "
<< q_21_1.revenue + q_21_2.revenue << endl;
}
else {
cout << "Data must refer to same bookNo" << endl;
}
}