продумать структуру и типы полей для создания баз данных "страны мира"​

Ответы

Ответ дал: nazikmuz
0

Відповідь:

#include <iostream>

 

using namespace std;

struct country{

char name[40];

unsigned long long int population;

char Capital[40];

};

void CINdata(country *list,int amount){

for(int i = 0; i < amount; i++){

 cout << "Страна: ";

 cin >> list[i].name;

 cout << "Столица: ";

 cin >> list[i].Capital;

 cout << "Население: ";

 cin >> list[i].population;

}

}

void PRINTdata(country *list,int amount){

for(int i = 0; i < amount; i++){

 cout << i + 1 << ". Страна: " << list[i].name << " Столица: " << list[i].Capital << " Население: " << list[i].population << endl;

}

}

int main(){

setlocale(LC_ALL , "Rus");

int amount;

cout << "Введите кол-во стран: ";

cin >> amount;

country *list = new country[amount];

CINdata(list,amount);

PRINTdata(list,amount);

delete[] list;

return 0;

}

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