Поможіть з програмуванням, мова С++, даю много балов

Приложения:

orakul96: массив в конце выводить нужно?
050814misha: Нужно

Ответы

Ответ дал: orakul96
1

include <iostream>

#include <vector>

#include <string>

#include <iomanip>

using namespace std;

struct Drink

{

string name = "";

int calories = 0;

string taste = "";

};

void Print(vector <Drink> A) {

cout << "==========================================" << endl;

for (int i = 0; i < A.size(); i++)

{

 

 cout << " || "<< A[i].name << " || " << A[i].calories << " || " << A[i].taste << " || " << endl;

}

cout << "==========================================" << endl;

}

int main()

{

int N;

cin >> N;

vector <Drink> drink(N);

for (int i = 0; i < drink.size(); i++)

{

 cin >> drink[i].name;

 cin >> drink[i].calories;

 cin>> drink[i].taste;

}

Print(drink);

system("pause");

return 0;

}

Вас заинтересует