English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Topic: Write a program that allows the user to enter numbers in the range 0-19, terminated by a sentinel, and then perform the following functiosn on the numbers: the average number, the maximum number, the range, the median

#include
#include
#include
#include
#include

using namespace std;

2007-02-13 09:08:10 · 2 answers · asked by clock 2 in Computers & Internet Programming & Design

FYI for the first two answerers: i have done the program but it has a problem which i posted in yahoo answers, but no one seems to be smart enough to answer it

2007-02-13 09:44:02 · update #1

2 answers

Try this:

cout << "1"
cout << "am 2"
cout << "st"
cout << "up"
cout << "id"
cout << "an"
cout << "d la"
cout << "zy 2"
cout << "due"
cout << "hom"
cout << "e"
cout << "work"

2007-02-13 09:18:52 · answer #1 · answered by Someone who cares 7 · 0 1

Why do you have to use those libs?

Looks like all you'd need is iostream.

int myInput=0;
do {
cout << "Give me a number: ";
cin >> myInput;
if (myInput == -1) {
cout << "C-ya!" << endl;
}
else if (myInput < 0 || myInput >19) {
cout << "Bad number... Try again!" << endl;
}
else
numbersRead++;
numberTotal+=myInput;
if (myInput>maxNumber)
maxNumber=myInput;

and so on...

Your instructor would probably want you to complete it yourself.

2007-02-13 17:32:02 · answer #2 · answered by BigRez 6 · 0 0

fedest.com, questions and answers