Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. struct country {
  7. string name;
  8. int population;
  9. string capital;
  10. bool yesno = false;
  11. country() {
  12. cout << "Name of Country:";
  13. cin >> name;
  14. cout << "Population:";
  15. cin >> population;
  16. if (population >= 100000) yesno = true;
  17. cout << "Capital:";
  18. cin >> capital;
  19. }
  20. };
  21.  
  22. struct continent {
  23. string name;
  24. int count;
  25. bool result = false;
  26. continent() {
  27. cout << "Name of continent:";
  28. cin >> name;
  29. cout << "How many countries?:";
  30. cin >> count;
  31. country *countries = new country[count];
  32. for (int i=0; i<count; i++)
  33. if (countries[i].yesno) result = true;
  34. }
  35. };
  36.  
  37. int main() {
  38. cout << "How many continents? : ";
  39.  
  40. int n;
  41. cin >> n;
  42.  
  43. continent *continents = new continent[n];
  44.  
  45. for (int i = 0; i < n; i++) {
  46. *(continents+i);
  47. }
  48.  
  49. for (int i = 0; i < n; i++) {
  50. cout << continents[i].result << " ";
  51. }
  52. delete[] continents;
  53.  
  54. system("pause");
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement