Pseudocode Help

Newb Question

Page 1 of 1

5 Replies - 2143 Views - Last Post: 17 March 2005 - 07:36 AM Rate Topic: -----

#1 Nismo662  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-March 05

Pseudocode Help

Posted 16 March 2005 - 09:28 PM

Hey i am wondering

What is the purpose of this code. i have trouble reading Psuedo:'( .

Begin
myNumber = 0
mycounter = 0
Input myinput
While myNumber is less than myInput
IF myNumber is even
Increment myTally

End IF
Increment mycounter

End While

Print mycounter
Print Mynumber

End
Is This A Good Question/Topic? 0
  • +

Replies To: Pseudocode Help

#2 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: Pseudocode Help

Posted 16 March 2005 - 09:41 PM

Nismo662, on Mar 16 2005, 09:28 PM, said:

Begin //this is pseudo for the entry point, (c++ - void main())
myNumber = 0 //these are variables, probably integers
mycounter = 0
Input myinput //prompt the user for input, probably another integer

While myNumber is less than myInput //while the above integer is less than the input number

IF myNumber is even //self explanatory :P
Increment myTally //add one to the myTally integer

End IF
Increment mycounter //increment a counter of some sort

End While

Print mycounter //display the counter
Print Mynumber //print 'mynumber' variable

End //end program

My comments are in the quote.
Was This Post Helpful? 0
  • +
  • -

#3 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: Pseudocode Help

Posted 16 March 2005 - 09:41 PM

Also, welcome to dream.in.code!
Was This Post Helpful? 0
  • +
  • -

#4 Nismo662  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-March 05

Re: Pseudocode Help

Posted 16 March 2005 - 09:46 PM

Whoa you guys are fast. Thnx for the welcome. Hopefully soon i can contribute too :D
Was This Post Helpful? 0
  • +
  • -

#5 Nismo662  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-March 05

Re: Pseudocode Help

Post icon  Posted 16 March 2005 - 09:49 PM

User types in a number.. then it loops for that number of times and counts all the even numbers ?

This post has been edited by Nismo662: 16 March 2005 - 10:42 PM

Was This Post Helpful? 0
  • +
  • -

#6 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Pseudocode Help

Posted 17 March 2005 - 07:36 AM

It loops while the number entered by the user is greater than the compared number, and counts each even entry. myTally is the variable that holds the number of even entries. myCounter holds the total number of entries.

In this case, as long as the user enters positive numbers (greater than 0), the program will loop.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1