Lengkap

Age-O-Meter #2

Modify your Age-O-Meter program so that it loops until one of the following conditions occurs:

the sentinel value of -99 is entered by the user

a total of five valid ages processed

The sentinal value must be defined as a manifest constant and it must be included in the prompt.

If a negative age other than the sentinel value is entered, then print an error message to the standard error stream and re-prompt the user to enter an age.

Prior to terminating the program, print the following:

number of valid ages entered

the sum of all the valid ages entered

the average of the valid ages entered

Be sure to protect against a divide-by-zero.

Example Output

Enter an age (-99 to exit): -5

-5 is not a valid age.

Enter an age (-99 to exit): 1

You are 1 year old and you are a baby.

Enter an age (-99 to exit): 44

You are 44 years old and you are in prime time.

Enter an age (-99 to exit): -99

# ages entered: 2

# of total years: 45

average age entered: 22.500000

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

## Platform

Windows XP

Kemahiran: Pengaturcaraan C, PHP

Lihat lagi: stream programming, programming loops, prime number one, prime number of 2, prime number example, prime number 2, prime number 1, prime no 1, one prime number, one is not a prime number, one a prime number, n 1 prime, loops programming, loops in programming, is zero a prime number, is the number one prime, is the number one a prime number, is the number 1 prime, is the number 1 a prime number, is prime number

Tentang Majikan:
( 27 ulasan ) France

ID Projek: #2881165

Dianugerahkan kepada:

newyorkphalanx

See private message.

$3 USD dalam 14 hari
(2 Ulasan)
0.4

5 pekerja bebas membida secara purata $6 untuk pekerjaan ini

mstrocan

See private message.

$3.4 USD dalam 14 hari
(65 Ulasan)
4.7
mobilehelp

See private message.

$8.5 USD dalam 14 hari
(24 Ulasan)
4.0
fabianjones

See private message.

$6.8 USD dalam 14 hari
(20 Ulasan)
3.3
peternahas

See private message.

$10.2 USD dalam 14 hari
(0 Ulasan)
0.0