|
-
Oct 5th, 2011, 03:37 PM
#1
Thread Starter
Junior Member
A simple do/while/loop structure i'm having trouble with.
I have to create an application that lets a user enter as much grades he wants. The grades are between 0 and 100 and they can't be negative. Whenever the user type -1, the application is done and it shows the average of the grades, the lowest and the highest grades.
I absolutly have no idea where to start but i must be using loop/do/while.
I'm willing to send 5$ through paypal if you can guide me into the right direction =D
-
Oct 5th, 2011, 05:16 PM
#2
Re: A simple do/while/loop structure i'm having trouble with.
We don't do homework (and somebody would have to be mighty hard up to do anything for $5), but we are willing to help out if you start off. You might start by listing the steps that the program will have to perform in order. That doesn't mean the question, but the things that the program will have to be able to do to work as described. For instance, it obviously must ask the user for some input. Does it need to do anything after that? How will you get that input (most classes cover only one or two ways, so you probably have very limitted options here)? What will you do with that input once you get it? And so forth.
My usual boring signature: Nothing
 
-
Oct 5th, 2011, 06:27 PM
#3
Re: A simple do/while/loop structure i'm having trouble with.
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
Oct 5th, 2011, 08:39 PM
#4
Thread Starter
Junior Member
Re: A simple do/while/loop structure i'm having trouble with.
Thanx for the links
Ill post my results later
-
Oct 5th, 2011, 08:54 PM
#5
Re: A simple do/while/loop structure i'm having trouble with.
Don't worry about the money ... but:
vb Code:
Dim Results As New List(Of Integer)
Console.WriteLine("Enter Results (-1 when done):")
Do
Dim strResult = Console.ReadLine()
Dim CurrentResult As Integer
If Integer.TryParse(strResult, CurrentResult) Then
If CurrentResult = -1 Then
'show results
Console.Clear()
If Results.Count > 0 Then
Console.WriteLine("Average: " & Results.Average)
Console.WriteLine("Highest: " & Results.Max)
Console.WriteLine("Highest: " & Results.Min)
Console.ReadKey()
End If
Return
Else
Results.Add(CurrentResult)
End If
Else
Console.WriteLine("You must enter an integer!")
End If
Loop
Kris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|