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

Username:   Password: 
 RegisterRegister   
 delete a person (important) please help(THIS NOW WORKS)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
skier




PostPosted: Mon Nov 08, 2004 6:42 pm   Post subject: delete a person (important) please help(THIS NOW WORKS)

i am trying to get this to delete a person. the part in question is the
code:
proc delete
end delete

any thoughts?

code:

var name : array 1 .. 6 of string
var model : array 1 .. 6 of string
var company : array 1 .. 6 of string
var phone : array 1 .. 6 of int
var snowday : array 1 .. 6 of int
var experience : array 1 .. 6 of int
var choice : int
var font1 : int
var font2 : int
var total : int
var large : int
var small : int
var aver : real
var main : string (1)
var l : string
var s : string

large := 0
small := 100000
font1 := Font.New ("Snap ITC:10")
font2 := Font.New ("Snap ITC:18")

proc values

    name (1) := "1) Carl Holland"
    name (2) := "2) Jake Reid"
    name (3) := "3) Alen Kimple"
    name (4) := "4) Ryan Lowe"
    name (5) := "5) Kevin Edwards"
    name (6) := "6) Sam Burns"

    company (1) := "Rossignol/LINE/Armada"
    company (2) := "Head/LINE"
    company (3) := "Armada/LINE"
    company (4) := "Rossignol"
    company (5) := "Atomic"
    company (6) := "Atomic"

    model (1) := "Scratch FS/Mike Nick Pro/ARV"
    model (2) := "Mad Trix/Twelve Sixty"
    model (3) := "AR5/Twelve Sixty"
    model (4) := "Carve 5.0"
    model (5) := "S-Daddy Pimp"
    model (6) := "Beta 9.1"

    phone (1) := (905 - 668 - 8687)
    phone (2) := (905 - 683 - 1059)
    phone (3) := (905 - 683 - 5697)
    phone (4) := (905 - 721 - 5286)
    phone (5) := (905 - 896 - 6427)
    phone (6) := (905 - 668 - 1384)

    snowday (1) := 67
    snowday (2) := 71
    snowday (3) := 73
    snowday (4) := 50
    snowday (5) := 2
    snowday (6) := 10

    experience (1) := 10
    experience (2) := 10
    experience (3) := 8
    experience (4) := 7
    experience (5) := 17
    experience (6) := 6

end values

proc displayall

    cls
    locate (8, 7)
    put "Name              Fav Company              Weapon of choice"
    for i : 1 .. 6
        locate (10 + i, 7)
        put name (i)
        locate (10 + i, 25)
        put company (i)
        locate (10 + i, 50)
        put model (i)
    end for
    put ""
    put ""

    put "Hit a key to return to the menu"

    getch (main)

end displayall

proc average
    var total : int
    var aver : real
    total := 0
    for i : 1 .. 6
        total := total + snowday (i)
    end for
    aver := total div 6
    cls
    put "The average number of days on the hill last year was ", aver : 4 : 2
    put "Hit a key to return to the menu"

    getch (main)

end average

proc mostexperience

    for i : 1 .. 6
        if experience (i) > large then
            large := experience (i)
            l := name (i)
        end if
    end for
    cls

    put ""
    put "The the person with the most experience is  ", l, " : ", large, " years."
    put ""
    put "Hit a key to return to the menu"

    getch (main)

end mostexperience

proc leastexperience

    for i : 1 .. 6
        if experience (i) < small then
            small := experience (i)
            s := name (i)
        end if
    end for
    cls

    put ""
    put "The the person with the least experience is  ", s, " : ", small, " years."
    put ""
    put "Hit a key to return to the menu"

    getch (main)

end leastexperience

proc delete
    cls
    for i : 1 .. 6
        put name (i)
    end for

    for i : 1 .. 6

        put "Which skier would you like to delete?"
        get name (i)
       
        if name (i) > intstr (0) and name (i) < intstr (7) then
            name (i) := ""
        end if
        exit when name (i) > intstr (0) and name (i) < intstr (7)
    end for
    cls


    getch (main)

end delete

proc menu
    colorback (12)
    cls
    color (7)

    Draw.Text ("FREESKIERS", 240, 260, font2, blue)

    Draw.Text ("1) Display all riders, companies and thier weapon(s) of choice", 125, 200, font1, blue)

    Draw.Text ("2) Average number of days on the snow last year", 125, 185, font1, blue)

    Draw.Text ("3) Phone Numbers (Alphabetically)", 125, 170, font1, blue)

    Draw.Text ("4) Skier with most experience", 125, 155, font1, blue)

    Draw.Text ("5) Skier with least experience", 125, 140, font1, blue)

    Draw.Text ("6) Add a skier", 125, 125, font1, blue)

    Draw.Text ("7) Delete a skier", 125, 110, font1, blue)

    Draw.Text ("8) Quit", 125, 95, font1, blue)
end menu

values
loop
    menu
    get choice
    if choice = 1 then
        displayall
    end if
    if choice = 2 then
        average
    end if
    %if choice = 3 then
    %    choice3
    %end if
    if choice = 4 then
        mostexperience
    end if
    if choice = 5 then
        leastexperience
    end if
    %if choice = 6 then
    %xdfj
    %end if
    if choice = 7 then
        delete
    end if

    exit when choice = 8
end loop
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Mon Nov 08, 2004 7:25 pm   Post subject: (No subject)

first off check your code because it doesn't really work so i cant run it to see what the problem is. secondly i don't really understand what u are trying to do because if your just trying to erase something u could use a cls to clear the screen. give some more details on what the problem is and i will try to help u.
skier




PostPosted: Mon Nov 08, 2004 7:32 pm   Post subject: (No subject)

it should now work
skier




PostPosted: Mon Nov 08, 2004 7:33 pm   Post subject: (No subject)

when you run it go to option 7
you will see what i mean
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  [ 4 Posts ]
Jump to:   


Style:  
Search: