Computer Science Canada Need Help Making a Data Base that Accepts Names and Phone #s |
Author: | Beast_ [ Sat Jan 21, 2006 11:39 pm ] |
Post subject: | Need Help Making a Data Base that Accepts Names and Phone #s |
Hey, I have a program that I have to make. I have to store phone numbers and names, then later on I have to print them off in a list. After I list the names and phone numbers off, I must be able to continue from there on and enter more names/phonenumbes, if I wish. Now I am able to store numbers only in the name and phonenumbers field. For some odd reason, Turing isnt allowing me to store actual word's. Just numbers. I've tried specifying the variables to strings, but it is erroring up in the for statement I have made. I must have this problem resolved. If any of you can help me, I would deeply appreciate it. Anyway, here is my progress so far: var howMany : int put "How many names and phone numbers?" .. get howMany var firstname, lastname, phone : array 1 .. howMany of int for i : 1 .. howMany put "Enter first name number ", i, ": " .. get firstname (i) put "Enter last name number ", i, ": ".. get lastname (i) put "Enter phonenumber # ", i, ": ".. get phone (i) end for for i : 1 .. howMany put "Info number ", i, " ",firstname (i)," ".. put lastname (i), " ".. put phone (i) end for It just wont allow me to enter names. I need to get this problem solved. And do you guys know how to enter names which have spaces between them? For example, when the program says enter a name, you enter John Smith and it stores the variable instead of "John." I don't quite remember, but I tried putting a semicolon ( ![]() thanks for your time. ![]() |
Author: | Talion [ Sun Jan 22, 2006 8:21 am ] |
Post subject: | |
your array is of int. So therefore everything going into it must be integer as well. make it of string. Then you can enter the numbers and names. ![]() oh and to enter both names as one variable go 'get name:*' that'll allow you to enter a line of text to one variable. |
Author: | GinoGuy [ Sun Jan 22, 2006 11:27 am ] |
Post subject: | |
Okay, so we can get names now I don't understand the part where it says "get firstname:*" When I type that in, it says "illegal get item". :/ ALSO, how can we get it to ask if they want to continue, and start up at the same number they left off? EDIT: I got the :* thing, but I still needed help with the last part |
Author: | Delos [ Sun Jan 22, 2006 12:12 pm ] |
Post subject: | |
GinoGuy wrote: Okay, so we can get names now
I don't understand the part where it says "get firstname:*" When I type that in, it says "illegal get item". :/ ALSO, how can we get it to ask if they want to continue, and start up at the same number they left off? EDIT: I got the :* thing, but I still needed help with the last part That's not really an easy question to answer, since we haven't seen your code. By 'we' do you mean you are somehow affiliated with Beast_? Or are you coincidentally just doing a similar project? From what I can figure, you'll have to add a conditional exit to the for loop. |
Author: | GinoGuy [ Sun Jan 22, 2006 1:04 pm ] | ||
Post subject: | |||
And yes, I am affiliated with Beast ![]() |
Author: | GinoGuy [ Sun Jan 22, 2006 5:18 pm ] | ||
Post subject: | |||
Before this topic goes far down the list, I have pulled together a bit better code with some remarks to show you what I actually need, and in a bit better detail. Here it is
|
Author: | Beast_ [ Sun Jan 22, 2006 9:10 pm ] | ||
Post subject: | |||
I was able to do this, dont know if it is much:
|