Write a C++ program that reads N numbers (positive, negative, integer and double numbers) from the keyboard, calculates and displays the following information.
a. Count of all negative numbers. If no negative numbers are entered, 0 for the count value should be displayed.
b. Sum of all positive numbers. If no positive numbers are entered, 0 for the sum value should be displayed.
c. Average of first two negative numbers. If two negative numbers are not entered, 0 for the average value should be displayed.
d. Largest number of all numbers entered from the keyboard.
e. Reverse order of first two numbers. The reverse order of two numbers 3.2 6.5 is 6.5 3.2.
f. Area (area = pi*r2) using the smallest positive number as a radius (r) and pi=3.14.
N should be declared as a constant in your program and it should be equal to the largest digit of your student id number. Assume N=2, if the largest digit of your student id number is less than 2.
The program should contain only a main function. User defined functions and arrays should not be used
in this assignment. If you use arrays or functions, you will be penalised 25% of the total marks for the
assignment. You should also not use things which are not part of this course. You will be penalised 25% of the total marks for the assignment, if you use things (eg. classes, linked list, etc.) which are not covered in this course.
Recently Asked Questions
- What did Sir Robert Clive do in 1750? Question 22 options: a) Founded the British trading post at Madras b) Defeated the French military assault in India c)
- Zinc reacts with hydrochloric acid according to the reaction equation shown. Zn(s)+2HCl(aq)ZnCl2(aq)+H2g) How many milliliters of5.00M HCl(aq) are required to
- A student classification system associates student with his or her weight. Use this relationship to answer (a) and (b) below. (a) In the given relationship, is