Develop a C++ program to get the temperature and print the following status according to the given temperature by using the else if ladder statement in the function.
1. T<=0 "Its very very cold"
2. 0 < T < 0 "Its cold"
3. 10 < T < =20 "Its cool out"
4. 20 < T < =30 "Its warm"
5. T>30 "Its hot"
Implement a C++ program to overload the function named as sum, to perform sum of two integer and perform sum of float two number respectively.
Develop a C++ program to get the temperature and print the following status according to the given temperature by using else if ladder statement in function.
1. T<=0 "Its very very cold"
2. 0 < T < 0 "Its cold"
3. 10 < T < =20 "Its cool out"
4. 20 < T < =30 "Its warm"
5. T>30 "Its hot"
Construct a C++ program to find the square of a number using default arguments and inline functions
Repeating & Non-Repeating Numbers
Given a list of numbers, find and print, the first number that occurs only once in the list and the first number that occurs more than once in the list.
The input will be a single line containing space-separated integers.
The first line of the output should contain the first non-repeating number. The second line of output should contain first repeating number. If there is no number fitting the given criteria, print "None" instead.
For example, if the given list of integers are 5, 5, 4, 7, 4, 1, 11 , the first non-repeating number is 7 and the first repeating number is 5.
Sample Input 1
5 5 4 7 4 1 11
Sample Output 1
7
5
Sample Input 2
1 2 3 4 5 6 7 8 9
Sample Output 2
1
None
Swap the contents of two variables using a third variable.
Find the average of two numbers given by the user.
Receive 3 numbers and display them in ascending order from smallest to largest
Construct the class Complex that has floating point data members for storing real and imaginary parts and perform complex number subtraction using operator Overloading.
he class Complex has the following member functions:
Complex() - Null constructor invokes when an object is created
Complex(float, float) - Parameterized constructor to set the specified value of real and imaginary parts in object
Operator()- To subtract an object from another object
print() - Function to display complex number object
Test Case: 1
INPUT:
R1:15
I1: 2
R2: 5
I2: 10
OUTPUT:
A =15 + i2
B = 5 + i10
C = 10 + i(-8)
Design a C++ program having a base class Student with data member rollno and member functions getnum() to input rollno and putnum() to display rollno. The class Test is derived from class Student with data member marks and member functions getmarks() to input marks and putmarks() to display marks. The class Sports is also derived from class Student with data member score and member functions getscore() to input score and putscore() to display score. The class Result is inherited from two base classes, class Test and class Sports with data member total and a member function display() to display rollno, marks, score and the total (marks + score).
Testcase:
INPUT:
2
80
80
80
65
OUTPUT:
Roll no:2
Mark1:80
Mark2:80
Mark3:80
Sports score:65
Total:305 Ap 3 5