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

Username:   Password: 
 RegisterRegister   
 Restarting a program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GhettoSingh




PostPosted: Tue Jun 10, 2003 10:25 pm   Post subject: Restarting a program

I have this program and i'm wondering how would i make it at the end as if they want to play again and how to start the procoss over again.

here's my prgm

colorback (black)
cls
for colors:1..60

var font3:int font3:= Font.New ("Algerian:18")
Font.Draw ("Calender Program Created by", 150, 200, font3, colors)
Font.Draw ("Amardeep & Mark", 200, 160, font3, colors)
delay (50)
end for
delay (9)

colorback (white)
for a:1..25
put ""
end for
color (blue)
var month : array 1 .. 12 of int := init (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
%-This command puts all the numbers in order which they come in the calander. Ex. 31 days in january
var currweekday, currweek, selectedmonth : int
var w : string
put "For which month do want to see a calender (in numbers) ?"
get selectedmonth
put "What is the first day of this month? (0 is sunday, 6 is saturday)"
get currweekday

color (brightred)
if selectedmonth = 1 then %- These else if commands assign each number with a month
w := "January"
elsif selectedmonth = 2 then
w := "February"
elsif selectedmonth = 3 then
w := "March"
elsif selectedmonth = 4 then
w := "April"
elsif selectedmonth = 5 then
w := "May"
elsif selectedmonth = 6 then
w := "June"
elsif selectedmonth = 7 then
w := "July"
elsif selectedmonth = 8 then
w := "August"
elsif selectedmonth = 9 then
w := "September"
elsif selectedmonth = 10 then
w := "October"
elsif selectedmonth = 11 then
w := "November"
elsif selectedmonth = 12 then
w := "December"
end if

var font1: int font1:= Font.New ("Algerian:15") %-This command changes the font size and color and location
locate (8, 39 - length (w) div 2)
Font.Draw ( w,253, 275, font1, red)
locate (10, 30)
var font2: int font2:= Font.New ("Arial:10")
Font.Draw ( "S M T W T F S ", 234, 245, font2, blue)
currweek := 1
for currday : 1 .. month (selectedmonth) %-This for command starts the process of the calender
locate (currweek + 10, (currweekday + 10) * 3)
put currday
if currweekday = 6 then
currweekday := 0
currweek += 1
else
currweekday += 1
end if
end for
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jun 10, 2003 10:44 pm   Post subject: (No subject)

put the playing part inside a loop. Here's the tricky part though...

You have to declear all your variables OUTSIDE the loop, but initialize them INSIDE.

Man... cant belive I used to program like this Confused Why cant they just start teaching OOP instead of drawing boxes Crying or Very sad
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: Tue Jun 10, 2003 10:51 pm   Post subject: (No subject)

what's oop?!
Catalyst




PostPosted: Tue Jun 10, 2003 11:07 pm   Post subject: (No subject)

object-oriented-programming

programming using objects (classes and such)
very useful and efficient
almost everyone of my programs is done using OOP
(besides the trivial ones)
Martin




PostPosted: Wed Jun 11, 2003 12:54 am   Post subject: (No subject)

Yeah me too. Except for the ones that aren't, all of my programs are OOP Razz
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  [ 5 Posts ]
Jump to:   


Style:  
Search: