Can someone please help!
Author |
Message |
kelseyyrosee
|
Posted: Wed Feb 24, 2010 3:08 pm Post subject: Can someone please help! |
|
|
We were told to make a seating plan for our ICS4U class, and I am stuck on how to get the information and save it to a file, and how to load everyones pictures... if anyone could help?
const DATAFILE := "data.txt"
const MAXSTUDENTS:= 24
var student: array 1 .. MAXSTUDENTS of string
var number : array 1 .. MAXSTUDENTS of real
procedure Titlescreen
setscreen ("graphics:v16")
const l := 400
const w := 200
const half_l := l div 2
const half_w := w div 2
const midx := maxx div 2
const midy := maxy div 2
const border := 10
const midr := maxrow div 2
const midc := maxcol div 2
const Title := "Seating Plan Project"
const Caption := "Concerns? email 87716@student.rrdsb.com"
const title_len := length (Title)
const caption_len := length (Caption)
%---------------------------------------------------------------
drawfillbox (0, 0, maxx, maxy, 38)
drawfillbox (midx - half_l, midy - half_w, midx + half_l, midy + half_w, 35)
drawfillbox (midx - half_l + border, midy - half_w + border, midx + half_l - border, midy + half_w - border, 53)
color (1)
colorback (53)
locate (midr - 2, midc - title_len div 2)
put Title
locate (midr + 1, midc - caption_len div 2)
put Caption
drawfillbox (midx + half_l - border, midy - half_w, midx + half_l, midy + half_w, 35)
drawfillbox (midx + half_l, midy - half_w, maxx, maxy, 38)
delay (3000)
end Titlescreen
%-----------------------------------------------------------------------------------------
%-----------------------------------------------------------------------------------------
procedure menu
setscreen ("nocursor")
const l := 400
const w := 200
const half_l := l div 2
const half_w := w div 2
const midx := maxx div 2
const midy := maxy div 2
const border := 10
const midr := maxrow div 2
const midc := maxcol div 2
drawfillbox (0, 0, maxx, maxy, 38)
drawfillbox (midx - half_l, midy - half_w, midx + half_l, midy + half_w, 35)
drawfillbox (midx - half_l + border, midy - half_w + border, midx + half_l - border, midy + half_w - border, 53)
color (1)
colorback (53)
locate (maxrow div 2 - 2, maxcol div 2 - 10)
put "1. New Student"
locate (maxrow div 2 - 1, maxcol div 2 - 10)
put "2. Delete Student"
locate (maxrow div 2, maxcol div 2 - 10)
put "3. View seating plan"
locate (maxrow div 2 + 1, maxcol div 2 - 10)
put "4. Edit seating plan"
locate (maxrow div 2 + 2, maxcol div 2 - 10)
put "5. Quit"
drawfillbox (midx + half_l - border, midy - half_w, midx + half_l, midy + half_w, 35)
drawfillbox (midx + half_l, midy - half_w, maxx, maxy, 38)
end menu
proc New_Student
cls
var new_student : string := ""
var new_number : int := -1
var seat : int := -1
put "Enter the student's name"
get new_student : *
put "Enter the student's Student Number"
get new_number
put "What seat number would you ike this student to sit in?"
get seat
if seat > 24 then
put "Invalid seat number"
delay(1000)
end if
end New_Student
proc Delete_Student
end Delete_Student
proc View_Plan
end View_Plan
proc Edit_Plan
end Edit_Plan
%VARIABLE DECLARATION SECTION--------------------------------------------------------------
%------------------------------------------------------------------------------------------
var choice : string (1) := ""
%MAIN---------------------------------------------------------------------------------------
Titlescreen
delay (1000)
loop
menu
getch (choice)
if choice = "1" then
New_Student
elsif choice = "2" then
Delete_Student
elsif choice = "3" then
View_Plan
elsif choice = "4" then
Edit_Plan
elsif choice = "5" then
exit
else
put "Invalid Choice!"
end if
end loop |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TerranceN
|
Posted: Wed Feb 24, 2010 4:10 pm Post subject: Re: Can someone please help! |
|
|
First of all use syntax tags, so it can be indented and colour coded, like this:
code: | [syntax="Turing"]
% Your code here
% You can even indent it too!
[/syntax] |
For the file stuff, you should go into the turing documentation and look up the following commands: open, close, read, write. As for the pictures, I have honestly never loaded a picture in turing, but you should look at the Pic commands (ie Pic.Draw, Pic.FileNew). |
|
|
|
|
|
Turing_Gamer
|
Posted: Thu Feb 25, 2010 8:21 am Post subject: Re: Can someone please help! |
|
|
For pictures, have Pic.Draw...
For files, I don't know |
|
|
|
|
|
DemonWasp
|
Posted: Thu Feb 25, 2010 12:05 pm Post subject: RE:Can someone please help! |
|
|
For file I/O, you need to open a file and then either put to it, or get from it. Look up the bolded words in the Turing help to find out how to do it. |
|
|
|
|
|
|
|