Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Visual Logic software and HELP! needed


  • This topic is locked This topic is locked

#1
kgabbard

kgabbard

    New Member

  • Member
  • Pip
  • 4 posts
Hello,

I'm a college student taking Programming Design and Logic course. The class uses VisualLogic for it's main source of logic design and later we'll use VB.NET. I am working on a problem which isn't very diffucult, but I can't seem to get a grasp on it. It reads:

******


"Write a program that reads in a list of positive intergers from the user until the user enters the value -1 as a sentinel. At that time, the program should display the largest value in the input list."

I have no problem figuring the problem with averaging the numbers input, but I can't seem to recall how to make the program recognize the largest number entered, esp. when using a pre-test while loop because the program just keeps going until -1 is entered. It doesn't seem that there is anything to compare it to, via an if statement. I would love it is somebody could help me. Thanks!

Kristin
  • 0

Advertisements


#2
StephenL

StephenL

    Member

  • Member
  • PipPip
  • 12 posts
Each time a user enters a positve integer you could compare it to a temporary maximum entered value variable or store. So that when -1 is entered the maximum number can then be called from the temporary variable.

int Max_Num = 0

While (num entered != -1)
if num entered > Max_Num
store num entered in Max_Num
end while

Display Max_Num

PS: apologies for the quick & poor psuedo code

This way Max_Num is only updated when it is greater than the previous maximum number, skipping if the newly entered number is less than the current value in Max_Num.

Cheers,
Steve
  • 0

#3
kgabbard

kgabbard

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
I'm sorry, but I don't understand the pseudo code and how to input that into the software I'm using which is very simplistic (VisualLogic). Could somebody please elaborate a little bit? Thanks!

KG

Edited by kgabbard, 23 April 2006 - 01:35 PM.

  • 0

#4
StephenL

StephenL

    Member

  • Member
  • PipPip
  • 12 posts
I've not heard of Visual Logic before but what I suggest you try to do is put an if statement within the while loop (if it is possible to use an IF statement).
You need to setup a place to store a value (variable or something) that will act as store to keep the current maximum value entered.
Then place an if statement within the while loop to check if the new entered value is higher than the value stored within the maximum value store. If so, replace the current maximum value with the newly entered value - if not, do nothing
Then display this value after the user has entered '-1'

Cheers,
Steve

setup a local variable to store the current max value

http://www.simul8.co.../vl.htm#VLLocal

then you can use an if statement to check against this upon every entry in the while loop

Edited by StephenL, 23 April 2006 - 01:57 PM.

  • 0

#5
kgabbard

kgabbard

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
I am still confused, following what was told to me as best as I can, I am getting no answer that is right. Can anyone help!?!
  • 0

#6
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Ooh, why do you use VisualLogic - I have never heard of it :blink:. It looks way more complicated and at the same time more crippled than VB.net. I could supply you the VB code, for sure it will be easier to type it than to do it in VisualLogic. :whistling:
  • 0

#7
kgabbard

kgabbard

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Yeah, I really do not like the program, but it's one of those stupid programs they make you use. It's one of the first versions, I really don't know many that like it. If you could supply me with the VB code, that would be awesome. I will deduct from that how to input all of it into VisualLogic. Thanks!

Kristin
  • 0

#8
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Alright, remember this is VB6.0. It is written from top of my head, so I am not 100% if it runs well.
Dim intInput As Integer
Dim intMax As Integer

Public Sub Main()
  'use do..loop statement
  Do
	 intInput = InputBox("Enter your value please")

	 If intInput > intMax Then
	   intMax = intInput
	 End If
  Loop Until intInput = -1

  'print the largest number
  Print intMax
End Sub

Edited by Hai Mac, 25 April 2006 - 08:00 AM.

  • 0

#9
killion

killion

    New Member

  • Member
  • Pip
  • 1 posts
Once you figured out how to put the Visual Basic code into Visual Logic could you post your vls file or give an explanation in Visual Logic terms because i'm stuck on that same problem for class.
  • 0

#10
ohhso0stephanie

ohhso0stephanie

    New Member

  • Member
  • Pip
  • 7 posts
hi. im in need of help using the visual logic program. im taking logic and design class in college and im getting so stuck. especially when using decision structures.

this is actually one of the programs we needed to create and i dont know every time i fix it i still cant get it right:
1. Ask a user to enter a student name, two exam grades and three research paper grades

2. Calculate the student's final average and determine his/her letter grade. The final average is calculated by averaging the exam average and the research paper average. The letter grade depends on the final average as shown below:

Final Average Letter Grade

90 or above A

At least 80 but below 90 B

At least 70 but below 80 C

At least 60 but below 70 D

Below 60 F

Final average = (exam average + research paper average) / 2

3. Output the student name, final average and letter grade using two separate message boxes.



i dont know what im doing wrong.
so if anyone can help me it would be appreciated

thankss
  • 0

Advertisements


#11
G33KINFO

G33KINFO

    New Member

  • Member
  • Pip
  • 2 posts
I think I know what you are trying to do if you still need help i'll try to give some info and if it helps thats great.
I am new to college too and got a similar assignment that I just figured out.

hi. im in need of help using the visual logic program. im taking logic and design class in college and im getting so stuck. especially when using decision structures.

this is actually one of the programs we needed to create and i dont know every time i fix it i still cant get it right:
1. Ask a user to enter a student name, two exam grades and three research paper grades

2. Calculate the student's final average and determine his/her letter grade. The final average is calculated by averaging the exam average and the research paper average. The letter grade depends on the final average as shown below:

Final Average Letter Grade

90 or above A

At least 80 but below 90 B

At least 70 but below 80 C

At least 60 but below 70 D

Below 60 F

Final average = (exam average + research paper average) / 2

3. Output the student name, final average and letter grade using two separate message boxes.



i dont know what im doing wrong.
so if anyone can help me it would be appreciated

thankss


  • 0

#12
tremerefury

tremerefury

    New Member

  • Member
  • Pip
  • 1 posts
"Write a program that reads in a list of positive intergers from the user until the user enters the value -1 as a sentinel. At that time, the program should display the largest value in the input list."



it should look something like this.

Attached Files


Edited by tremerefury, 14 November 2008 - 02:18 PM.

  • 0

#13
CrazySticks

CrazySticks

    New Member

  • Member
  • Pip
  • 1 posts
Hello
I need help with Visual logic Im to creat a logic for a Mad Lib program that displays a message asking the user to provide five words, and then accept those words and creat and display a short story or nursey rhyme that uses them.
  • 0

#14
Benjamin Bleser

Benjamin Bleser

    New Member

  • Member
  • Pip
  • 1 posts

Each time a user enters a positve integer you could compare it to a temporary maximum entered value variable or store. So that when -1 is entered the maximum number can then be called from the temporary variable.

int Max_Num = 0

While (num entered != -1)
if num entered > Max_Num
store num entered in Max_Num
end while

Display Max_Num

PS: apologies for the quick & poor psuedo code

This way Max_Num is only updated when it is greater than the previous maximum number, skipping if the newly entered number is less than the current value in Max_Num.

Cheers,
Steve



So here's what I got from you:

The beginning input statement must equal Int (as you put it) right?

And your modifier is a condition within the WHILE Loop? Or should I have an IF Condition after my initial input as well?

It would seem your logic also implies that there is an Assignment Variable labeled Num before the WHILE Loop.

Unless MAX_num is the integer value to be entered?

I know it ultimately refers back to Assignment 2, with the Average, but identifying the integers into code while maintaining the logic without error seems [bleep] near impossible.
  • 0

#15
Benjamin Bleser

Benjamin Bleser

    New Member

  • Member
  • Pip
  • 1 posts
it double posted sorry

Edited by Benjamin Bleser, 14 September 2009 - 01:08 AM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP