{
int j_Id, j_Age, j_BuyCount;
printf("Enter book Id ");
scanf("%d", &j_Id);
printf("Enter book Age ");
scanf("%d", &j_Age);
printf("Enter book BuyCount ");
scanf("%d", &j_BuyCount);
book book_1(j_Id, j_Age, j_BuyCount);
//----------------- ðåçóëüòàòû
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 == 2)
{
int Id, Age, BuyCount;
float Prise, Reyting;
book book_1;
printf("Enter book Id ");
scanf("%d", &Id);
printf("Enter book Age ");
scanf("%d", &Age);
printf("Enter book BuyCount ");
scanf("%d", &BuyCount);
printf("Enter book Prise ");
scanf("%f", &Prise);
printf("Enter book Reyting ");
scanf("%f", &Reyting);
book_1.initialization(Id, Age, BuyCount, Prise, Reyting);
//----------------- ðåçóëüòàòû
int choose_result;
printf(" How we going to see the result\n");
printf(" 1. On the screen \n");
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.