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

Username:   Password: 
 RegisterRegister   
 hi i need help in turing programming. how to do between programing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fatal_xxkillerzxx




PostPosted: Wed Nov 28, 2012 10:05 pm   Post subject: hi i need help in turing programming. how to do between programing

Turing:

% modify mark analysis program to count only the number of students eligible for supplemental exams(mark between 40 and 49)
var passinggrade : int
var finalgrade : int
var count : int

var mark :real
var mark1 :real



put " do you know the passing mark?"
get passinggrade


put " How many students are you marking? " ..
get count


for c : 1 .. count


    put "Enter mark for student: ", c

    get finalgrade


    if finalgrade >= passinggrade then


        put "Student passes"
        put ""

    else

        put " Student fails"

        put ""
mark:=   (0.49*100 - 0.40*100)

if finalgrade=mark then % if mark is = 40 to 49 shows
            put " supplemental exam"

       

end if

end if
end for


plz need help Crying or Very sad Question

Mod Edit:

Pleas wrap you code in either of the following in order to preserve whitespace (indentation) and to highlight the syntax.
code:

[syntax="turing"] ... code ... [/syntax]

[code] ... code ... [/code ]
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Wed Nov 28, 2012 10:15 pm   Post subject: RE:hi i need help in turing programming. how to do between programing

"how to do between programing" ...

I'm sorry, what was the question?
Panphobia




PostPosted: Wed Nov 28, 2012 10:16 pm   Post subject: RE:hi i need help in turing programming. how to do between programing

and what do you need help with?
AntoxicatedDevil78




PostPosted: Thu Nov 29, 2012 10:34 am   Post subject: Re: hi i need help in turing programming. how to do between programing

State you Problem?
Zren




PostPosted: Thu Nov 29, 2012 11:37 am   Post subject: RE:hi i need help in turing programming. how to do between programing

So apparently reading your whole post for context was a good idea.

You know that to find a number above 3, you use the x > 3 relation operator? You should also know if a number is greater or equal to 3, you'd use x >= 3.

The above statements will return true if their statements are correct.

Eg:
Turing:

x := 3
put x > 3 % Output: false

x := 3
put x >= 3 % Output: true


Another tool you have at your disposal is Logical/Conditional operators. More specifically, the AND operator.

Turing:

put true and true % Output true
put true and false % Output false
put false and true % Output false
put false and false % Output false

Note that this was an example of a Truth Table (https://en.wikipedia.org/wiki/Truth_table#Logical_conjunction).

Now the actual problem.

First lets breakdown the problem into smaller , solvable, problems. Rewording the problem tends to help.
> Count only the number of students eligible for supplemental exams(mark between 40 and 49).

Count only the number of students that have marks between 40 and 49.

You should have notes on how to make a counter. If not, ask.

The second sub-problem is what you're asking about. How do you find out if a number is in the range of 40 .. 49? How do you find a number above 40? How do you find a number below 49? How do you find a number that solves both conditions at once?
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  [ 5 Posts ]
Jump to:   


Style:  
Search: