Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how do i start this program?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kid105




PostPosted: Tue Jan 12, 2010 10:48 pm   Post subject: how do i start this program?

What is it you are trying to achieve?
write a program which accepts a list of real numbers from the keyboard and dislays the highest and lowest numbers in the list. the user is to decide how many of numbers are to be entered


What is the problem you are having?
i know i have to use an array and i want the user to input 10 numbers and display them from hightest to lowest


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Tue Jan 12, 2010 11:25 pm   Post subject: RE:how do i start this program?

If you're not going to make any effort, don't post.

This can be solved with 3 variables and a for-loop.
DemonWasp




PostPosted: Tue Jan 12, 2010 11:42 pm   Post subject: RE:how do i start this program?

Pretend you're the computer. Equip yourself with a piece of paper, pencil and NO COMPUTERS ALLOWED. Either have someone else help you, or pretend that you're being given a series of numbers by someone else.

Record anything you need to remember on the sheet of paper and think about exactly why you need each piece of information. Then, think about how you can use that information to answer the questions your program needs to answer (what is the highest number? what is the lowest number?).

Next, change that into a set of instructions for you to follow. These should be simple English instructions, numbered starting from 1. They should be very simple, to the point that a child could follow them. Instructions like "say hello" and "read a number" are allowed, but instructions like "find the highest number" are a little too complicated at this point*. You are allowed to say things like "return to step 3" and "skip steps 4-6"**. Test that these instructions work by following them STRICTLY. No leeway, because the computer isn't going to give you any leeway if you give it the wrong instructions.

Once you've done that, figure out how to go from the list of instructions in English to the list of instructions in Turing. This should be the simplest and easiest step, because each instruction should be simple enough that it's maybe a line or two of Turing code.

Notes:
* Eventually, instructions like "select the highest number in a sequence of numbers" will become valid instructions, as soon as you know how to do that in Turing / Java / C++ / whatever language trivially.
** Things like "return to step 3" imply loops (loop, for) and things like "skip steps 4-6" imply conditionals (if).
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: