Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
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

bartleby

Step by stepSolved in 3 steps with 3 images

[画像:Blurred answer]
Knowledge Booster
Background pattern image
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
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education