Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- struct country {
- string name;
- int population;
- string capital;
- bool yesno = false;
- country() {
- cout << "Name of Country:";
- cin >> name;
- cout << "Population:";
- cin >> population;
- if (population >= 100000) yesno = true;
- cout << "Capital:";
- cin >> capital;
- }
- };
- struct continent {
- string name;
- int count;
- bool result = false;
- continent() {
- cout << "Name of continent:";
- cin >> name;
- cout << "How many countries?:";
- cin >> count;
- country *countries = new country[count];
- for (int i=0; i<count; i++)
- if (countries[i].yesno) result = true;
- }
- };
- int main() {
- cout << "How many continents? : ";
- int n;
- cin >> n;
- continent *continents = new continent[n];
- for (int i = 0; i < n; i++) {
- *(continents+i);
- }
- for (int i = 0; i < n; i++) {
- cout << continents[i].result << " ";
- }
- delete[] continents;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement