Homework #9 Solution

$30.00

Category:

Description

Write a C program that keeps information about world countries. There could be at most 100 countries. Use C Structures with the following data fields to represent countries.

 

  • Country name (at 25 characters),
  • Country population,
  • Country area in km squares,
  • Number of soldiers in the army,
  • Neighbor countries (at most 10 neighbors, 0 for island countries)

 

When your program runs, it should offer the following options

 

  • Add a country (if user presses corresponding key, in this case: ‘a’), (Type ‘-1’ to finish neighbor input )

 

  • Print name of the most powerful country in terms of military strength in vicinity of a given country (among neighbors of neighbors of given country including itself )

 

  • Print name of the largest country in terms of land it possesses in vicinity of a given country (among neighbors of neighbors of given country including itself )

 

  • Calculates and prints how many people at minimum should be seen if I need to go from a given country to another given country (Assume that if I visit a country, I would see all people of that country). If the target country is inaccessible then print INACCESSIBLE.

 

  • Exit the program (Presses key ‘e’)

 

 

 

Sample Usage

 

Make your choice:

 

a

 

Turkiye

 

79000000

 

815000

 

640000

 

Azerbaycan

 

Bulgaristan

 

Ermenistan

 

Gurcistan

 

Irak

 

Iran

 

Suriye

 

Yunanistan

 

-1

 

Make your choice:

 

b

 

Turkiye

 

<output>Turkiye

 

Make your choice:

 

c

 

Turkiye

 

<output>Turkiye

 

Make your choice:

 

d

 

Turkiye Bulgaristan

 

<output>INACCESSIBLE

 

Make your choice:

 

e

 

<output>Good Bye

 

 

#notes

 

  • You should send your main function completely.

 

  • The assignment must be your original work. Duplicate or very similar assignments are both going to be considered as cheating.

 

  • Ask your questions via moodle.

error: Content is protected !!