Question no # 1. Write a C++ program using structures to make three objects of Person structure and change the
name data type to string at the time of structure defining. Take values for first object using
initialization method P1= {“name”, age, salary}, get values for second object through initializing
each and every object value e.g P1.name = “name” and for third object get value from user and
display the values of all three objects.
Question no # 2 . Write a C++ program to complete the following code snippet:
StudentRecord Class[3];
strcpy(Class[2].Name, "Ali");
Class[2].Id = 12345;
strcpy(Class[2].Dept, "COMP");
Class[2].gender = 'M';
Class[0] = Class[2];
Hint: Use string library and array of structure to compete the task.
Question no # 3 . Write a C++ program to create a structure name student and write getdata, displaydata functions
for an array of structures. Maximum information of 3 students must be displayed.
Question no # 4 . Write a C++ program to create a nested structure for car and its owner details.
Comments
Leave a comment