Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,538 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,764 people online right now. Registration is fast and FREE... Join Now!




pseudo code

 
Reply to this topicStart new topic

pseudo code, Help!

Tinadureen
20 Aug, 2008 - 06:08 PM
Post #1

New D.I.C Head
*

Joined: 20 Aug, 2008
Posts: 1

I am SOOO new to VB and am actually on my first assignment and was hoping i could get some input on if Im on the right track with what i have so far...

the problem i have to solve is:

"The folder C:\Testyou may or may not exist. If it does exist, it may have one or more folders immediately beneath it. For each of those folders, if they contain text files, display the contents of all the text files to the user. If a folder contains no text files, display a message to the user indicating this. If there are no folders within C:\Testyou or C:\Testyou does not exist, again, display an error message."

so far, heres what I have:



If folder C:\Testyou does not exist then
create folder C:\Testyou


Else

If there are any subfolders in C:\Testyou then
Display all subfolders

Else
If there are no subfolders in C:\Testyou then
Display error message to user

Else

If there are any text files in C:\Testyou then
Display text files to user

Else
If there are no text files in C:\Testyou then
Display error message to user

Else
If the folder C:\Testyou does not exist then
Display error message to user

End if

I would so appreciate any help. This is an online class so I have limited contact with my instructor, although I have sent him the same email, and I just want to get it right!!!

Thanks in advance to anyone who can give me some input~! blink.gif

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Pseudo Code
20 Aug, 2008 - 09:31 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,213



Thanked: 217 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Here is something you can go by. The trick is to follow each sentence of the paragraph and shorten it by mixing a bit of code syntax with english. That way someone can still read it, but it is shortened. It is like code "paraphrasing".
Notice the structure of indentation and use of things like "if", "else" and "for each"

CODE

If c:\Testyou exists then
     if number of subfolders > zero then
          for each subfolder
               if text files in subfolder > zero then
                    for each text file
                         print contents of text file
                    next text file
               else
                    display message saying no text files
          next subfolder
     else
          display message saying there are no subfolders
else
     display message saying c:\Testyou does not exist


Please compare this pseudocode to what your paragraph and make sure you see the correlation. This is an important skill when you get out in the industry.

Enjoy!

"At DIC we be psuedocode ninjas... if we be > all then print we be awesome, else print You will never reach this message" decap.gif

User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 10:30PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month