Write a user-defined program to declare a class which stores a complex number. Demonstrate the use of constant objects , constant member function and constant arguments, using this class.
Write a program to take input for two integer variables. Assign the value -1 to the variable with higher value using a function.
[Use return by reference ]
Write a program in which there is a global variable, a local variable for main function and a variable in a nested scope inside main, with the same name. Print all the three variables.
Write a menu-driven program to create a class ‘num’ which stores an integer number. Derive three classes from ‘num’ class namely ‘binary’, ‘octal’ and ‘hexa’ which store the binary, octal and hexadecimal equivalent of the number in ‘num’ class. Input an integer value at run-time and display its binary, octal and hexadecimal equivalent.
Create the classes as per the hierarchy given below. The data members are mentioned along with class name. Include parameterized constructor in all the classes. Input data at run-time for a student, calculate the total marks and percentage and display them.
Student: Name, Roll Number
|
V
Marks: marks in 5 subjects
|
V
Result: total marks, percentage
Create a class employee which stores is name, ID and salary of an employee by user input. The ID should be generated upon the creation of object, starting from 1. Include all the constructors and destructor in the class. Create one object using each of the constructors and display it.
The program should have an array of 12 structures to hold weather data for an entire year. When the program runs, it should ask the user to enter data for each month. The program then should display month-wise min., max. and average temperatures and rainfalls in a table-like format. In addition, it should display average min., average max. and average mean temperature of the entire year. Similarly, it should display average min., average max. and average mean rainfall of the entire year. The following checks should be implemented for valid input. • Temperature range: -70 to +60 C • Rainfall range: 1mm to 25mm • Min. value <= Average value <= Max value
Write a program that uses the following three structures to store the weather data for a particular month: