We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,716 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Pseudocode with arrays

I need an example of how to create pseudocode using arrays to accomplish the following tasks:


Read and store user information in an array
Store 10 random winning numbers in an array
Compare user lottery numbers with winning numbers
Print names of the winners

Thanks!

2
Contributors
3
Replies
1 Day
Discussion Span
1 Year Ago
Last Updated
4
Views
Johnson0803
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

do x times ( x = the amount of users)
- read user information
- store user information
do ten times
- generate random winning number
- store generated number in array
do x times
- set flag to true (true = got all numbers correct)
- do y times (y = the amount of lottery numbers)
- compare number to next generated number
- if not equal
- set flag to false
- if flag = true (still true, actually)
- print userName " is a winner!"

stultuske
Industrious Poster
4,370 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 23

How would you create this pseudocode using the while statement using the same information below?


do x times ( x = the amount of users)
- read user information
- store user information
do ten times
- generate random winning number
- store generated number in array
do x times
- set flag to true (true = got all numbers correct)
- do y times (y = the amount of lottery numbers)
- compare number to next generated number
- if not equal
- set flag to false
- if flag = true (still true, actually)
- print userName " is a winner!"

Johnson0803
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

several remarks: you asked for pseudocode, I gave you pseudocode. if you want to know how to code it, don't you think it would give us a big hand if you told us what language you are (intending to be) using?

well ... the first questions that come to my mind are:
1. what language?
2. what have you tried yourself?
3. why didn't you post this thread in the forum for that specific language?

stultuske
Industrious Poster
4,370 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 23

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0565 seconds using 2.64MB