Comment on Tutorial - Using switch Statements in C++ By Emiley J



Comment Added by : basil

Comment Added at : 2011-08-04 13:00:30

Comment on Tutorial : Using switch Statements in C++ By Emiley J
3. Write a program that will continuously ask for an integer input from the user until a negative
value is entered. Display the sum and the average of the numbers entered (not including the
negative sentinel value). (Filename: Filename: Exer6.cpp)
Example output:
Please enter number 1? 10
Please enter number 2? 8
Please enter number 3? 3
Please enter number 3? -1
Average is 7.
Computer for sum and average again [Y/N]? N
Goodbye.


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Nice example. I think this is more idiomatic tho'.
View Tutorial          By: John Morrison at 2010-03-28 14:55:07

2. when i am trying to compile your program one error
View Tutorial          By: anindya at 2011-11-23 03:00:49

3. This is very useful for java beginners
View Tutorial          By: Syed Musthafa at 2011-11-20 07:11:50

4. I want to get SCJP!
View Tutorial          By: Johny at 2009-08-24 22:48:56

5. getting the below

Thu Aug 28 23:24:

View Tutorial          By: sudswain at 2014-08-28 17:59:55

6. This is a great article that deals with the evolut
View Tutorial          By: JPS SASTRY at 2009-02-11 21:29:56

7. i have run the code successfully but it does not s
View Tutorial          By: amrish at 2010-12-11 07:00:28

8. U should give the output also.. then only it will
View Tutorial          By: Mohamed Younus at 2011-07-07 10:13:54

9. Thanks a lot...I've been trying to fix my apache f
View Tutorial          By: Lázaro at 2010-01-20 03:32:07

10. /*for (i=0; i<lim-1 && (c=getchar())!=E
View Tutorial          By: GD at 2012-07-14 12:47:27