We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8
1.
Define a structure data type called time_struct containing three
members integer hour, integer minute and integer second. Develop a program that would assign values to the individual members and display the time in the form as 16:40:51 2. Define a structure data type named date containing three integer members day, month, and year. The input data should be three integers like 29, 4, and 2002 corresponding to day, month, and year. Examples of invalid data: 31, 4, 2002 – April has only 30 days 29, 2, 2002 – 2002 is not a leap year. Develop an interactive program to perform the following tasks: ○ To read data into structure members ○ To validate the date entered. ○ To print the date in the format April 29, 2002. 3. Create two structures named metric and British which store the values of distances. The metric structure stores the values in metres and centimetres and the British structure stores the values in feet and inches. Write a program that reads values for the structure variables and adds values contained in one variable of metric to the contents of another variable of British. The program should display the result in the format of feet and inches or metres and centimetres as required. 4. Define a structure called cricket that will describe the following information: player name, team name, and batting average. Using cricket, declare an array player with 50 elements and write a program to read the information about all the 50 players and print a team-wise list containing names of players with their batting average. 5. Define a structure that can describe an hotel. It should have members that include the name, address, grade, average room charge, and number of rooms. Write a program to perform the following operations: ○ To print out hotels of a given grade in order of charges. ○ To print out hotels with room charges less than a given value. 6. Design a structure student_record to contain name, date of birth, and total marks obtained. Use the date structure designed in Exercise 2 to represent the date of birth. Develop a program to read data for 10 students in a class and list them rank-wise.