Program in C. Create a program that asks the user for information about a country. It should ask the user for the country’s name, the country’s most famous sport, the country’s most popular food and the country’s capital. When done reading information from the user, it should print out all the information received. You have to use strings. Each string should be 70 characters long. Your input should accept white spaces and your output should print white spaces. When scanning, make sure you use one of the methods seen in class (whichever method you prefer). Same for printing, from the methods we saw in class, use whichever method you prefer to print strings. Notes: No need of functions (everything can be done in main if you want to) and no need of structures (you can use separate strings if you want to). Also, your program does not have to check whether or not the user inputted more than 70 characters.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
Question

Program in C.

Create a program that asks the user for information about a country. It should ask the user for the country’s name, the country’s most famous sport, the country’s most popular food and the country’s capital. When done reading information from the user, it should print out all the information received. You have to use strings. Each string should be 70 characters long. Your input should accept white spaces and your output should print white spaces. When scanning, make sure you use one of the methods seen in class (whichever method you prefer). Same for printing, from the methods we saw in class, use whichever method you prefer to print strings.

Notes: No need of functions (everything can be done in main if you want to) and no need of structures (you can use separate strings if you want to). Also, your program does not have to check whether or not the user inputted more than 70 characters.

Expert Solution
Step 1

Program:

//include the header file
#include <stdio.h>

//definition of main function
int main()
{
//declare the required variables
char country_name[70];
char sports[70];
char food[70];
char capital[70];

//get the country name
printf("Enter the country name: ");
gets(country_name);

//get the sport name
printf("Enter the country’s most famous sport: ");
gets(sports);

//get the food
printf("Enter the country’s most popular food: ");
gets(food);

//get the capital
printf("Enter the country’s capital: ");
gets(capital);

//display the outputs
printf("\n\nTHE DETAILS OF THE COUNTRY\n");
printf("\nThe country name is: %s ", country_name);
printf("\nThe country’s most famous sport is: %s ", sports);
printf("\nThe country’s most popular food is: %s ", food);
printf("\nThe country’s capital is: %s \n", capital);

//return statement
return0;
}
Step 2

Screenshot of the program:

Computer Science homework question answer, step 2, image 1

Computer Science homework question answer, step 2, image 2

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr