Sei sulla pagina 1di 3

Structures

Program 1
Write a program that declares a structure to store Roll no, marks ,average and grade of a student. The
program should define a structure variable, input the values and then displays the values .
Program 2
Write a program that declares a structure to store day, month and year of birth date. it inputs three
values and displays date of birth in dd/mm//yy format.
Program 3
Write a program that declares a structure to store Book ID, price and pages of a book. it defines two
structure variable and inputs values. it displays the record of most costly book.
Program 4
Write a program that declares a structure to store employee id and salary of an employee. it defines and
initialize a structure variable and displays it.
Program 5
Write a program that uses a structure to store three parts of phone number i.e. National code, area
code,Number separately.create two variable of structure phone, initialize one variable and get input
from the user in the second variable and then displays both numbers.
Program 6
Write a program that uses structure to store employee number, name, hours worked, hourly rate and
gross pay. the program inputs employee number, name, hours worked, hourly rate. calculates the gross
pay and then displays all employee data on screen.
Program 7
Write a program that declares a structure to store marks and grade of a student. it defines two structure
variable. It inputs the values in one variable and assigns that variable to the second variable. It finally
displays the values of both variables.
Program 8
Write a program that declares a structure to store roll no and marks of five subjects. It defines a
structure variable, inputs the values and displays roll no, marks and average marks.
Program 9

Write a program that declares a structure to store ID, pages and price of a book. It defines an array of
structure to store the record of five books. It inputs the record of five books and displays the most costly
book.
Program 10
Write a program that uses two structures result and records. The result structure stores marks and
grade ,record structure stores roll no and result type. the program declares a variable of type record,
inputs roll no, marks and grade. It finally displays these values on screen.
Program 11
Write a program that uses two structures date and phonebook. The date structure stores day, month
and year. Phonebook structure stores name, city, telephone and date type. The program declares a
variable of type phonebook, inputs values displays the values.
Program 12
Write a program that uses three structures Dimensions, Result and rectangle. The dimension structure
stores length and width, result structure stores area and perimeter and rectangle structure stores two
variable of dimension and result. The program declares a variable of type rectangle. Inputs length,
width, calculates area and width and then displays the result.
program s
1 : WAP to add two complax numbers by passing structure to a function
2 : WAP to check wether two Rectangles are equal or not (define structre Rectangle , two Rectangles
object pass to function and check there).
3 : WAP to define point in 3 dimensions and check the two points by passing in function , are equal or
not.

More Programming exercise

Write a program that declares a structure to store the distance covered by an player along with
the minutes and seconds taken to cover the distance. The program should input the record of
two players and then display the record of the winner.

Write a program that declares a structure to store the code number, salary and grade of an
employee. The program defines two structure variable, inputs record of two employees and
then displays the record of employee with more salary.

Write a program that declares a structure to store income, tax rate and tax of a person. The
program defines an array of structure to store the record of five persons. It inputs income and
tax rate of five persons and then displays the tax payable.

Write a program that declares a structure Book to store Book ID, book name and price. It
declares another structure Order that contains Order ID and an array of Book of length 5. The
program should define a variable of type Order and input the values from the user. The program
finally displays the values.

Potrebbero piacerti anche