Computer Science Canada

Help Turing Summative Translating underscores into spaces.

Author:  ilemondrop [ Sun Jan 20, 2013 12:13 am ]
Post subject:  Help Turing Summative Translating underscores into spaces.

What is it you are trying to achieve?
Successfully translating all the underscores i have in my text into spaces in the turing window.


What is the problem you are having?
they appear with the underscores instead of spaces at the moment.
example: hello_my_name_is
rather than
hello my name is

Describe what you have tried to solve this problem
By making a if statement for each section of the record and checking if it has an underscore and if so, put " ". else put the entire thing down.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
i know this is a little last minute, but if anyone can help me that is most appreciated
Turing:


for i : 1 .. 10
        if skiinfo (i).question = "_" then
            put " "
        else
            put skiinfo (i).question
            if skiinfo (i).answer1 = "_" then
                put " "
            else
                put skiinfo (i).answer1
                if skiinfo (i).answer2 = "_" then
                    put " "
                else
                    put skiinfo (i).answer2
                    if skiinfo (i).answer3 = "_" then
                        put " "
                    else
                        put skiinfo (i).answer3
                        if skiinfo (i).answer4 = "_" then
                            put " "
                        else
                            put skiinfo (i).answer4
                            loop
                                get test
                                if strrealok (test) then
                                    if strreal (test) <= 0 then
                                        put "Please enter a number above 0"
                                    elsif strreal (test) >= 5 then
                                        put "Please enter a number below 5"
                                    else
                                        answer(i) := strint (test)
                                        exit
                                    end if
                                else
                                    put "Please make sure you put in a number"
                                end if
                            end loop
                            if answer (i) = skiinfo (i).answer then
                                store (i) := true
                                counter:=counter+1
                            end if
                        end if
                    end if
                end if
            end if
        end if
    end for



Please specify what version of Turing you are using
4.1.1

Author:  Panphobia [ Sun Jan 20, 2013 1:52 am ]
Post subject:  RE:Help Turing Summative Translating underscores into spaces.

can you tell me exactly why you have so many if's inside if's, like what are you trying to accomplish with them?

Author:  Tony [ Sun Jan 20, 2013 7:25 pm ]
Post subject:  RE:Help Turing Summative Translating underscores into spaces.

code:

if skiinfo (i).question = "_" then


Are you expecting the entire question to be exactly "_" ?


: