use a trip value to stop the loop
Finding the lowest, highest and the average of the test scores in a class without using arrays in c++?
This is the sort of logic to use, though I don't know C++ specifically.
tripvalue = 4862317
min = 9999999
max = 0
count = 0
average = 0
\ set score to dummy value for first test in do while
score = 0
do while score %26lt;%26gt; tripvalue
...read score
...\ fi denotes end of if condition
... \ calculate total score in average
...average = average + score
...count = count + 1
...if score %26lt; min, then min = score fi
...if score %26gt; max, then max = score fi
repeat \ go back to do
average = average / count
stop
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment