| | |
Trouble with figuring out the flowchart to pseudocode problem
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Thread Solved
![]() |
Hi, could someone to direct me the right way with this? Here is the problem, which I think I have nailed:
before:
after (in pseudocode):
Now I have a trouble with the flowchart I have attached.
Here is a pseudocode that I figured out, and I know it is wrong:
Please let me know if the first problem is right, and if you could help me with how to tame the flowchart to get rid of the arrow from d to F...
Thanks in advance,
Waldis
before:
A if c then goto X B if d then goto Y C X: D E Y: F
after (in pseudocode):
A
if c then
D
E
else
B
if not d then
C
D
E
FNow I have a trouble with the flowchart I have attached.
Here is a pseudocode that I figured out, and I know it is wrong:
A
while c
B
if not d
E
else
need to break out of wile loop somehow to get to 'F'
FPlease let me know if the first problem is right, and if you could help me with how to tame the flowchart to get rid of the arrow from d to F...
Thanks in advance,
Waldis
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
First 2 are correct. last pseudocode is wrong.
I think it needs to be something like
I think it needs to be something like
A
if not c then b
while not d
{
if not c then c
D
E
}
F•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
sorry should not be a while loop just another if statement
A
if not c then b
if not d
{
if not c then c
D
E
}
F Thanks for your input.
Now I got completely confused... from c down ir TRUE, and from d down is FALSE.
By saying c after 'if not c then' do you mean setting c to TRUE? And by D you mean d, and setting it's value to TRUE?
You made my brain boil, but I didn't get anywhere...
Thanks for your help,
Waldis
Now I got completely confused... from c down ir TRUE, and from d down is FALSE.
By saying c after 'if not c then' do you mean setting c to TRUE? And by D you mean d, and setting it's value to TRUE?
You made my brain boil, but I didn't get anywhere...
Thanks for your help,
Waldis
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
I think we both got confused. I wasnt too sure what A B C etc meant. Are they states in a state machine? Or just processes? also do they run though the flow once or keep repeating? I thought they might be function calls or something . So the if not c then c meant if your c flag hasnt been set then do c.
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
I think i am with you now. i was confused between c and C and d and D. i take it A B C D E and F are some processes/functions etc. and c and d are flags?
In which case my pseudocode needs a minor modification i think
In which case my pseudocode needs a minor modification i think
A
if not c then B
if not d
{
if not c then C
D
E
}
F There is no 'C' or 'D', only 'c' and 'd', which are flags. A, B, E, and F are processes. When 'A' gets down to 'c' and flags it TRUE, it goes to 'B', if FALSE goes to 'F'. If we get to 'B' the next stop is a flag 'd', and if 'd' is TRUE it exits to 'F', if 'd' is FALSE it goes to 'E' and from 'E' goes back to the flag 'c' for another round if 'c' gets flagged TRUE.
The instructions was to modify the flowchart so the pseudocode could be written without GOTOs. And as I see the problem here is either the flag 'c' on the FALSE side or the flag 'd' on the TRUE side.
I hope I'm making sense here... and thanks for bearing with me.
The instructions was to modify the flowchart so the pseudocode could be written without GOTOs. And as I see the problem here is either the flag 'c' on the FALSE side or the flag 'd' on the TRUE side.
I hope I'm making sense here... and thanks for bearing with me.
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
Ok now i am totally lost. Your initial post had c and C and d and D but now you say there is no C or D? Your initial post also said if c is true to skip B but now you are saying if c is true to do B? Lets start again. I am with you that A B E F are processes and c & d are flags. Where do they get set? does the whole thing repeat?
There were two problems at the beginning. The first problem was the code with GOTOs and the solution that I wrote was the second code I included. Then I have the second problem, for which I attached the scanned image of the flowchart I'm having problem with. What I'm talking about (with no C and D, only c and d) is this second problem from the flowchart.
And you said that the first problem, as I understood, is correct.
And you said that the first problem, as I understood, is correct.
![]() |
Other Threads in the Computer Science Forum
- Previous Thread: Applet for checking constructed DFA to recognize the set of strings
- Next Thread: Another pseudocode problem...
| Thread Tools | Search this Thread |
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery bigbrother binary bittorrent bletchleypark bomb business cern codebreaker compiler computer computerscience computertrackingsoftware connect conversion csc dataanalysis dataintepretation development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosure foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homeowners homeworkassignment homeworkhelp humor ibm idea internet iphone ipod itcontracts jobs kindle laser laws lsmeans mainframes marketing mobileapplication msaccess nano netbeans networking news os p2p piracy piratebay principles rasterizer research sam-being-cute sas science software spying stephenfry study supercomputer sweden technology textfield turing turingtest two'scompliment uk virus ww2





