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

Username:   Password: 
 RegisterRegister   
 new window
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nin




PostPosted: Tue Jan 02, 2007 11:00 pm   Post subject: new window

how do u make a separate window for error messages and after it close when the user presses a key, then it will allow the user to go back to reenter the input values?

to make a window close to we put "Window.Close" at the end of the procedure?

where do i put the new window in my code?
----------------------------------------------------------------------------------
%Ninanori Agustin
%Ms.Dyke
%December 11 2006
%Loop Structure

% Global Declaration Section
var number : int
var answer : int
var tries : int := 3
var key : string (1)

%Title
procedure title
cls
locate (1, 33)
put "Guessing Game"
put ""
end title

%Pause Program
procedure pauseProgram
put " "
put "Press any key to continue: " ..
getch (key)
end pauseProgram

%Introduction
procedure introduction
title
locate (4, 1)
put "This program will allow you to guess a number between 10 and 65."
pauseProgram
end introduction

%User Input
procedure userInput
title
put "Please enter a number between 10 and 65: " ..
get number
if number < 10 or number > 65 then
put "Please enter a number that is between 10 and 65"
delay (1000)
userInput
end if
end userInput

%randNum
procedure randNum
randint (answer, 10, 65)
end randNum

%Display
procedure display
title
locate (4, 1)
put "Number chosen:", number
locate (5, 1)
put "The random number is:", answer
delay (2500)
cls
end display

%GoodBye
proc goodBye
locate (12, 35)
put "Good Bye!"
locate (13, 25)
put "Created by: !!!!!!!!!!!!!"
end goodBye


%Main Program
introduction
randNum
loop
userInput
if number not= answer then
tries := tries - 1
locate (12, 1)
put " "
locate (12, 30)
put "Please try again."
locate (13, 30)
put "Tries remaining:", tries
delay (2000)
end if
exit when number = answer or tries = 0
end loop
display
goodBye

%End of Program
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue Jan 02, 2007 11:03 pm   Post subject: (No subject)

wherever you would have an error, create your new window with the error message in it. The best idea would be to make a procedure that takes a string argument (the error) and create the window in the procedure, with the error printed in the window.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: