Question: write a c++ program which will give following output: Output Sample: ========== Input data ========== Enter the number of kingdoms: 2 Enter the name for

write a c++ program which will give following output:

Output Sample: ==========

Input data

==========

Enter the number of kingdoms: 2

Enter the name for kingdom #1: The_Vale

Enter the number people living in The_Vale: 234567

Enter the name for kingdom #2: The_Reach

Enter the number people living in The_Reach: 567890

==========

------------------------------

The first kingdom of Westeros

------------------------------

The_Vale, population 234567

------------------------------

here is the half completed code below,write the to do part which is half done

#include

#include "kingdom.h"

using namespace std;

using namespace westeros;

int main(void)

{

int count = 0; // the number of kingdoms in the array

// TODO: declare the pKingdoms pointer here (don't forget to initialize it to null)

cout << "==========" << endl

<< "Input data" << endl

<< "==========" << endl

<< "Enter the number of kingdoms: ";

cin >> count;

cin.ignore();

// TODO: allocate dynamic memory here for the pKingdoms pointer

for (int i = 0; i < count; ++i)

{

// TODO: add code to accept user input for the pKingdoms array

}

cout << "==========" << endl << endl;

// testing that "display(...)" works

cout << "------------------------------" << endl

<< "The first kingdom of Westeros" << endl

<< "------------------------------" << endl;

display(pKingdoms[0]);

cout << "------------------------------" << endl << endl;

// TODO: deallocate the dynamic memory here

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!