
-----------------------------------
avakann
Thu Jun 04, 2009 12:23 pm

ingnoring the IF statement but I want the if statement to work
-----------------------------------
help please
What is the problem you are having?
the progeramme doesn't do what I want it to do


Describe what you have tried to solve this problem
I've changed the variable, I even copied a part of the programme that worked the way I want it to work and even that didn't help


setscreen ("graphics:1050;650") 
colorback (6) % yellow 
cls  
var picID :int := Pic.FileNew ("X.bmp") 
var picy :int := Pic.FileNew ("Y.bmp")
var name1,name, age,twentyfirst, theoryX, theoryY : string
var relate1, colour1,independent1 : char
    put "what is your name?" %asks the first question
  get name1
put "what is my name?"
    get name
        if name = "Jason" or name = "jason" then
        put "right, next question."
        else
        put "wrong the answer is Jason or jason ", name1
        end if
    put "what is my age?"
    get age
        if age = "18" then
        put "right next question"
        else put "wrong I am 18 ", name1
        end if
    put "what was my score for 21st century manager?"
    get twentyfirst
        if twentyfirst= "7" then
            put "right, next question"
            else put "wrong my score was 7 ", name1
        end if
    put "this relates to me, how?"
    put "A: it is just a score, B: my name is jason, C: my biggest problem is my self confidence, D: the evil my heart tells me so"
    get relate1
        if relate1 = "C" or relate1 = "c" then
            put "right"
        elsif relate1 = "A" or relate1 = "a" or relate1 = "B" or relate1 = "b" or relate1 = "D" or relate1 = "d" then
            put "wrong it was C, or c ", name1
        else put "not even an answer"
        end if
    put "what was my score in theory X in theory X and Y quiz?"
    get theoryX
        if theoryX = "5" then
        put "right"
        else put "WRONG IT WAS 5 ", name1
        end if
    put "what was my score in theory Y in theory X and Y quiz?"
    get theoryY
        if theoryY = "6" then
        put "right"
        else put "that is wrong it was 6 ", name1
        end if
    Pic.Draw (picID, maxx div 2, maxy div 2,0)
    Pic.Free (picID)
    Pic.Draw (picy, maxx div 2 + 17, maxy div 2,0)
    put "what is the colour in the background for?"
    put "A: I found the colour looks cool, B: it is the closest to gold, and gold was the colour that was the closest to me, c:it was just the closest to gold, D:answer not available"
    get colour1
    if colour1 = "b" or colour1 = "B" then
            put "right"
        elsif colour1 = "A" or colour1 = "a" or colour1 = "C" or colour1 ="c" or colour1 = "D" or colour1 = "d" then
            put "wrong the answer was either B or b", name1
        else put "not even an answer"
    end if
    put "I am an independent,sensing,thinking,judging person, this is expressed by the fact in this project How?"
    put "A: the fact that this project is an original idea that gets people thinking B: I judged that this would be fun, and I was right, C: it was a long haul but my thinking got through it all, D: if you want the final answer put down d)"
    get independent1
      if independent1= "D" or independent1= "d" then
            put "Curiosity killed the cat"
            delay (200)
            put "WRONG ANSWER ", name1
        elsif independent1= "A" or independent1= "a" or independent1= "B" or independent1= "b" or independent1= "C" or independent1= "c" then
            put "that is correct ", name1
        else put "not even an answer"
    end if




Please specify what version of Turing you are using
the version is 4.0.5

-----------------------------------
Tony
Thu Jun 04, 2009 1:01 pm

Re: ingnoring the IF statement but I want the if statement to work
-----------------------------------

the progeramme doesn't do what I want it to do
It doesn't have to. It does do exactly what you've told it to do though. Sometimes there's discrepancy though. What is it that you want it to do? And how is that different from what you've told it to do?

-----------------------------------
avakann
Fri Jun 05, 2009 11:47 am

Re: ingnoring the IF statement but I want the if statement to work
-----------------------------------
Ok it doesn't do what I thought that I told it to do
for some reason it is ignoring the if statement and and I don't think that I told the programme to do that

-----------------------------------
jbking
Fri Jun 05, 2009 1:20 pm

Re: ingnoring the IF statement but I want the if statement to work
-----------------------------------
There are 8 "if" statements in the code.  Which one(s) are you meaning?  What kinds of things have you done to try to isolate the problem?  What is the expected and actual results you get and with what input?

These are just a few basic questions that would help some of us as well as show good faith that you do try to figure out your own problems as this is one of the big pillars of programming to my mind:  Being able to fix mistakes in your own software.

-----------------------------------
Wolf_Destiny
Fri Jun 05, 2009 9:52 pm

Re: ingnoring the IF statement but I want the if statement to work
-----------------------------------
So....it worked perfectly for me, (in)correct answers were dealt with appropriately, indicating success or failure, or invalid input where appropriate. Not really sure what the problem is at all, it didn't skip a single if statement when I ran it. Just for whatever sort of reference it might be worth, I'm running V4.0.3
~Wolf_Destiny

-----------------------------------
avakann
Wed Jun 10, 2009 12:00 pm

RE:ingnoring the IF statement but I want the if statement to work
-----------------------------------
it is ignoring the "if" statement for this line

if independent1= "D" or independent1= "d" then
            put "Curiosity killed the cat"
            delay (200)
            put "WRONG ANSWER ", name1
        elsif independent1= "A" or independent1= "a" or independent1= "B" or independent1= "b" or independent1= "C" or independent1= "c" then
            put "that is correct ", name1
        else put "not even an answer"
    end if
what am I doing wrong

-----------------------------------
Tony
Wed Jun 10, 2009 12:07 pm

RE:ingnoring the IF statement but I want the if statement to work
-----------------------------------
a good debugging technique is to output all the conditional variables, to inspect yourself. It will look something like
[code]
put "Debug: ", independent1
if independent1= "D" or independent1= "d" then
...
[/code]
If it seems visually correct, you can further try testing for conditional statements
[code]
put independent1= "D"
[/code]
