View the step-by-step solution to:

Write a C++ program that reads N numbers (positive, negative, integer and double numbers) from the keyboard, calculates and displays the following...

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.

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
• -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents