printf("Book bougth: %d", book_BuyCount);
printf("\n");
printf("Book Cost: %4.2f", book_Prise);
printf("\n");
printf("Book Reyting: %2.0f", book_Reyting);
printf("\n");
}
void book::initialization(int in_Id, int in_Age, int in_BuyCount, float in_Prise, float in_Reyting)
{
book_Id = in_Id;
book_Age = in_Age;
book_BuyCount = in_BuyCount;
book_Prise = in_Prise;
book_Reyting = in_Reyting;
}
void book::Remark()
{
book_Id += book_Remark;
}
//------------------------- ñîáñòâåííî main
void main()
{
srand((unsigned)time(NULL));
printf("Choose the way to initialization of the class\n");
printf("1. Constructor \n");
printf("2. Initializator\n");
int choose;
scanf("%d", &choose);
//-------------- èíèöèàëèçàöèÿ êîíñòðóêòîðîì
if (choose == 1)
{
int choose_construction;
printf(" Choose the Construction \n");
printf(" 1. Construstion Default\n");
printf(" 2. Construstion Anower\n");
scanf("%d", &choose_construction);
if (choose_construction == 1)
{
book book_1;
//----------------- ðåçóëüòàòû
int choose_result;
printf(" How we going to see the result\n");
printf(" 1. On the screen \n");
printf(" 2. In the file: \n");
scanf("%d", &choose_result);
if (choose_result == 1)
{
book_1.book_show();
}
if (choose_result == 2)
{
file = fopen("result.txt", "w");
fprintf(file,"***************************************************************\n");
fprintf(file,"* Book name * Id * Age * BuyCount * Prise * Reyting *\n");
fprintf(file,"***************************************************************\n");
fprintf(file,"* book_1 * %d *", book_1.book_Id);
fprintf(file," %d *", book_1.book_Age);
fprintf(file," %d *", book_1.book_BuyCount);
fprintf(file," %4.2f *", book_1.book_Prise);
fprintf(file," %2.0f *\n", book_1.book_Reyting);
fprintf(file,"***************************************************************\n");
fclose(file);
}
}
//------------------
if (choose_construction == 2)
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.