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;
}
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;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
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;
}