Assignment On Structures

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Assignment on Structures

1. Write a program to add two measurements of type Distance having elements


feet and inches
2. Declare a stucture having two parts to represent a complex no. ( real part and
imaginary part). Write a menu driven C++ program using functions to add,
subtract, multiply, and divide two complex numbers.

3. Write a function that accepts two dates using structures and returns the date
that is later.

4. A linear array of size 10 stores the following information : name of the


country, countrys capital and per capita income of the country. Write a menu
driven program to do the following.
a) To read all the data values
b) To read name of the country and display the capitals name and per
capita income.
5. Write a program for the given structure definition as below.
Name ( First Name, Middle name, Last name)
Age
Game
Address ( H.no., street, City, State)
Use nested structures. Declare an array to store data for n no of players. Input
a game and list the data for all players with the same game.
6. Define a structure to store the no. of elements in an array of integer nos, the
array itself, and the maximum and minimum elements in the array. Write a
program to read the array in function main() and pass the structure to a
function to evaluate and display maximum and minimum in main().( Hint :
Pass the structure by reference to the function)

You might also like