Написание программы, создающей класс с меню выбора инициализации и разными способами показа результата. Вариант 2, страница 4

                        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);

                        }

            }

}

3. Входные данные:

Choose the way to initialization of the class

1. Constructor

2. Initializator

1

     Choose the Construction

     1. Construstion Default

     2. Construstion Anower

1

          How we going to see the result

          1. On the screen

          2. In the file:

1

4. Выходные данные:

Book Id: 41

Book Age: 67

Book bougth: 34

Book Cost: 65.00

Book Reyting: 69

Press any key to continue

5. Выводы:

В результате была написана программа,  создающая класс, с меню выбора инициализации и разными способами показа результата.