lcombs 3 years ago does anyone know anything about Pseudo-code?

1. eSpeX

Pseudo code is just a tool to help you get the flow and thought of the program on paper. So if you know that you want something to happen so long as one condition is true you could write: /* pseudo code */ while this is true do something if this happens do this or else this /* end pseudo */ This way you can organize your thoughts before you actually sit down and start writing code.

2. lcombs

I have to write a Pseudocode based on turning Fahrenheit into Celsius.. With a formula of C=C=(f-32)*5/9. and Fahrenheit= (C*5/9)+32. Then a table with Fahrenheit Celsisus 32 0 60 15.56 90 32.2 12 -11 How would I start writing this code.

3. eSpeX

Assuming there were no specifics given during the outline of this assignment, I would do something along the lines of: Create variables and assign value; An array for each, assign to F for i equals zero, while i less than number of values, increment i; C[i] = f[i] - 32 * 5/9 Generate table display output

4. eSpeX

As you examine your code and evaluate each step you have to do you will find more details to add. Think of it as explaining to the computer in "human words" what steps to take.

5. lcombs

I am just trying to figure out how to start it.. Start Input tempToday If = F Then C=(f-32)*5/9?? Is that looking right?

6. eSpeX

That is a good start but you will probably want to add a little more detail the further you progress, like your input section could be: /* start */ Display prompt for user "Enter temp for today" Get input from user temp = input display prompt for conversion "Would you like to convert that to F or C?" get input from user, convert = input etc. etc.

7. paul99santos
8. eSpeX

Yes, that url has some good examples of pseudo code.

9. paul99santos

This question is a joke.

10. lcombs

11. eSpeX

OH SNAP! :D

12. eSpeX

If you look at the wiki url you can see how you will eventually get to the point of programming in "human words" rather than the programming language you are using.

13. lcombs

Sadly I have to use the programming language..

14. eSpeX

Writing the problem in code is much easier than pseudo code, IMHO.

15. lcombs

I agree but this teacher wants it in pseudocode.. And it is a complicated thing for me to understand..

16. paul99santos

Pseudocode is just syntax (e.g) program bizzbuzz do i = 1 to 100 set print_number to true if i is divisible by 3 print "Bizz" set print_number to false if i is divisible by 5 print "Buzz" set print_number to false if print_number, print i print a newline end do --------------------------------------------- you have to make a F` to C` for that.

17. eSpeX

Well you are on the right track, I can say that my professors did not require the closeness to programming that the example here is, and it is very likely that yours will not be that strict either. The main concept is most likely to get you to think about your code from another perspective and help you create a tangible link between "everyday" and programming. Keep going the direction you started I think it will become more clear as you progress. :)

18. farmdawgnation

@paul99santos Comments like "this question is a joke" aren't exactly in line with the spirit of OpenStudy. To quote the old adage, "If you have nothing good to say, say nothing at all."

19. nczempin

I'm getting confused. You're saying "Sadly I have to use the programming language.." and at the same time "this teacher wants it in pseudocode." It can't be both. If it has to be pseudocode that looks vaguely like your programming language (which one?), the task is eaasier than actually writing it in the language, because you don't have to make sure it compiles and runs correctly, just that someone can grasp the method you're using to solve the program (and presumably check that you're on the right track, and _then_ you can convert that pseudocode into real code). Sorry about the run-on sentence. IMHO atually writing down the code is _not_ easier than writing pseudocode, or drawing diagrams, or any combination of the two, for most non-trivial problems (of which converting a unit is not an example; my pseudocode would just say "convert to celsius")

20. farmdawgnation

@nczempin It's possible her teacher has a specific pseudocode syntax she's supposed to use. I've dealt with a few of those before.