You are on page 1of 1

1.

Define a structure for complex numbers and then define functions to add, subtract,
and multiply two complex numbers.
2. struct Empoyee comprises of EmployeeID, Name and Salary. EmployeeID and Salary
are int’s, whereas Name is a char string. Write a program to declare an array of 100
Employee’s and take input of EmployeeID, Name and Salary for these 100
employees. The program outputs the Name’s of Employee’s whose Salary is above
10000/-.
3. struct Student comprises of ID, Name and Marks. ID and Marks are integers, whereas
Name is a char string. Write a program that declares an array of 100 Students and
takes input of ID, Name and Marks for these 100 Students. The program outputs the
Name’s of all Students whose Marks are second highest. Note that there may more
than one student with highest and second highest marks.
4. Define a structure named census with the following three members. a. A character
array to store the name of the city. b. An integer to store the population of the city. c.
A float number to store the literacy level. Write three program to (i) sort the cities in
lexicographical order (like Mumbai should come before Nagpur and Nagpur should
be before Pune), (ii) sort based on literacy, and (iii) sort based on population.
5. Write a program to declare a structure Student that comprises of StudentID, Name and
TotalMarks. StudentID and Marks are int’s, whereas Name is a char string. Write a
program to declare an array that can accommodate 100 Student structures. The
program then takes as input StudentID, Name and TotalMarks for these 100 Student
structures and outputs the Names of top 10 Students (as per their TotalMarks).
6. Write a program to declare a structure Course that comprises of CourseID, Name and
prereq. Field CourseID is an identifier for a Course under consideration and is an int
type which is greater than 0. Field prereq is also of int type and it specifies a
CourseID of a prerequisite course. Field Name, a char string, gives the name of the
Course under consideration. Write a program to declare an array that can
accommodate 100 Course structures. The program then takes as input CourseID,
Name and prereq for these 100 Course structures. If a user enters CourseID that is less
than 1 then the program should prompt the user for entering another CourseID. If
there is a no prereq for a Course then the prereq value for it would be 0. The program
then outputs the Name of the Course that is prerequisite for maximum number of
Courses. Assume that every Course has one or none prerequisite.

You might also like