Тема: Не виводить всі данні в таблицю, а тількі останні
Не виводить всю введенну інформацію в таблицю, а тількі останні введені данні.
#include <iostream>
#include <string>
#include <Windows.h>
#include <iomanip>
using namespace std;
struct Stationery {
    string name_type;
    char item_type;
    short int min_amount;
    double price;
}stationery;
int main() {
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    int cntr;
    cout << "Данні: " << endl;
    for (cntr = 0; cntr < 9; cntr++) {
        cout << cntr + 1 << ". Найменування товару: ";
        cin >> stationery.name_type;
        if (stationery.name_type == "Кінець") {
            break;
        }
        cout << "\t" << "Тип товару: ";
        cin >> stationery.item_type;
        cout << "\t" << "Ціна за 1 шт.(грн.): ";
        cin >> stationery.price;
        cout << "\t" << "Мінімальна кількість у партії: ";
        cin >> stationery.min_amount;
        cout << endl;
    }
    cout << endl << endl << endl << endl << endl;
    cout << "-------------------------------------------------------------------------------------------" << endl;
    cout << "|                                          Прайс-лист                                     |" << endl;
    cout << "-------------------------------------------------------------------------------------------" << endl;
    cout << "| Найменування товару | Тип товару | Цiна за 1 шт. (грн.) | Мiнiмальна кiлькiсть у партiї |" << endl;
    cout << "-------------------------------------------------------------------------------------------" << endl;
    for (int cout_cntr = 0; cout_cntr < cntr; cout_cntr++) {
        cout << "|" << setw(14) << stationery.name_type << setw(8) << "|" << setw(6) << stationery.item_type << setw(7) << "|"
            << setw(13) << stationery.price << setw(10) << "|" << setw(17) << stationery.min_amount << setw(15) << "|"
            << endl;
        cout << "-------------------------------------------------------------------------------------------" << endl;
    }
    return 0;
}