#include <iostream>
#include <string>
#include <fstream>
using namespace std;

/*
*Коротко о программе: программа создана для подсчёта проданных книг(по количеству,имени, цене) 
*/




class MainProgramCore {
public:
	ofstream fout;
	void getNameAndPrice() {
		int price = 0;
		string name = "";
		fout.open("soldbooks.txt", ios_base::app);
		cout << "Hello. I'am your own helper! Type name then press enter and type price!";
		cin >> name >> price;
		fout << name <<":"<< price<<"$" << endl;
		fout.close();
	}
};

// Объявление переменных
void mainViarables();
int price, number; 
string name, answer;

int main() {
	MainProgramCore objMainProgramCore;
	cout << "Hello! If you sold any book, type Y. If you didn't, just ignore this message! : ";
	cin >> answer;
	if ((answer == "Y") || (answer == "y")) {
		cout << "Ok! How much books did you sell? Type number: ";
		cin >> number;
		for (int i = 0; i < number; i++) {
			objMainProgramCore.getNameAndPrice();
		}
		system("pause");
		return 0;

	}
}

