C/C++

Скиньте плз правильный вариант кода

#include <iostream>
using namespace std;

struct Kolya
{
int age;
float weight;
};

void kolya(int choice[2])
{
Kolya Kolyas[2];

Kolyas[1].age = 15;
Kolyas[1].weight = 52;

Kolyas[2].weight = 60;
Kolyas[2].age = 16;

cout << "What time do you want? \n1. Now\n2. Future" << endl;
cin >> choice[1];

if (choice[1] == 1)
{
cout << "1. Age or 2. Weight?" << endl;
cin >> choice[2];

if (choice[2] == 1)
{
cout << "Kolya's age: " << Kolyas[0].age << endl;
}

if (choice[2] == 2)
{
cout << "Kolya's weight: " << Kolyas[0].weight << endl;
}
else
{
cout << "Try again" << endl;
}
}

if (choice[1] == 2)
{
cout << "1. Weight or 2. Age?" << endl;
cin >> choice[2];

if (choice[2] == 1)
{
cout << "Kolya's weight: " << Kolyas[1].weight << endl;
}
if (choice[2] == 2)
{
cout << "Kolya's age: " << Kolyas[1].age << endl;
}
}
}

void Vanya(int choice[2])
{
struct Vanya
{
int age;
float weight;
};

Vanya Vanyas[2];

Vanyas[0].age = 15;
Vanyas[0].weight = 55;

Vanyas[1].weight = 63;
Vanyas[1].age = 17;

cout << "Who do you want?\n1. Now\n2. Future" << endl;
cin >> choice[1];

if (choice[1] == 1)
{
cout << "1. Age or 2. Weight?" << endl;
cin >> choice[2];

if (choice[2] == 1)
{
cout << "Vanya's age at 17: " << Vanyas[0].age << endl;
}
if (choice[2] == 2)
{
cout << "Vanya's weight at 17: " << Vanyas[0].weight << endl;
}
}

if (choice[1] == 2)
{
cout << "1. Weight or 2. Age?" << endl;
{
cout << "Vanya's weight at 19 will be: " << Vanyas[1].weight << endl;
if (choice[2] == 2)
{
cout << "His age at 19 will be: " << Vanyas[1].age << endl;
}
}
}
}

int main()
{
while (true)
{
cout << "Please, choose who you want to learn about: " << endl;
cout << "1. Kolya\n2. Vanya" << endl;
string choice;
cin >> choice;

if (choice == "Kolya" || "kolya")
{
kolya();
}

if (choice == "Vanya" || "vanya")
{
Vanya();
}
else
{
cout << "Try again" << endl;
}
}

return 0;
}
У меня нет комментариев сегодня. Поэтому, если не поймёшь - не отвечу вновь.
Я не знаю, что делает твоя программа. Ты не написал текст задания.
Но вот тут явная ошибка:
 void kolya(int choice[2]) 
{
Kolya Kolyas[2];

Kolyas[1].age = 15;
Kolyas[1].weight = 52;

Kolyas[2].weight = 60;
Kolyas[2].age = 16;
Индексы начинаются с нуля, а не с единицы. Это не Паскаль!
Вот:
 void kolya(int choice[2]) 
{
Kolya Kolyas[2];

Kolyas[0].age = 15;
Kolyas[0].weight = 52;

Kolyas[1].weight = 60;
Kolyas[1].age = 16;
Игорь Михайлов
Игорь Михайлов
1 565
Лучший ответ
 #include  
#include
#include
#include
#include
#include

using namespace std;

template
T input(istream& inp, const char* msg) {
cout > value;
inp.ignore(0x1000, '\n');
return value;
}

void trim(string& line) {
if (line.empty()) return;
while (isspace(line.front())) {
line.erase(line.begin());
}
while (isspace(line.back())) {
line.pop_back();
}
}

struct Person {
int age;
float weight;
float height;
string name;
Person() : age(0), weight(0), height(0), name("-") {}
bool equal(const string& name)const {
string a = name;
string b = this->name;
transform(name.begin(), name.end(), a.begin(), tolower);
transform(this->name.begin(), this->name.end(), b.begin(), tolower);
return a == b;
}
private:
friend istream& operator>>(istream& inp, Person& p) {
cout
Руслан 7182 Чаво
Слишком сложно, я только на массивах
 #include  
using namespace std;

struct Kolya
{
int age;
float weight;
};

void kolya()
{
Kolya Kolyas[2];

Kolyas[0].age = 15;
Kolyas[0].weight = 52;

Kolyas[1].weight = 60;
Kolyas[1].age = 16;

int choice;
cout choice;

if (choice == 1)
{
cout choice;

if (choice == 1)
{
cout