2000 LSU Computer Science High School Programming Contest
Language Specific Information

MAIN
  Home
  Schedule
  Rules
  Compile

RESULTS
  Results

PROBLEMS
  Novice
  Veteran
  All

   Table of Contents:

Return to the Top of Page, Index Page, Novice Problem Set, or Veteran Problem Set.

Borland Turbo Pascal v1.5 for Windows

    NOTES  |  File Naming Conventions  |  To Make It Work  |  Example Program  |  Judges Information

  • NOTES:

    • You must not try to use the debugger!!! It does not work and will crash the system (Turbo Pascal at least)!
    • You must have the uses WinCRT; at the top of your program to get output (if you are planning to do I/O with the keyboard and the screen).
    • You should only use READ, READLN, WRITE, and WRITELN (if you are plannig on doing keyboard/screen I/O).
    • If you are planning to do file I/O, you must name your input file test.in and your output file must be test.out. You must also put a comment at the top of your main program that says:
      (**************************
       ** I AM DOING FILE I/O  **
       **************************)

  • Filenaming Conventions:

    • All source submissions should have a file naming convention of p[n|v]<num>.pas where:
        [n|v] refers to either novice or veteran
        <num> refers to the problem number
      For example, if you are a novice team working on problem 3, your filename would be: pn3.pas
    • If you are planning to do file I/O, you must name your input file test.in and your output file must be test.out.

  • To Make It Work:

      You can trick standard I/O to reading from a file and writing to a file by doing the following:
    • At the top of the program, after the program declaration and before the var declaration, make sure there is
      	uses WinCRT;
      		
    • In the body of the program, after the main begin declaration, make sure there is
      	Assign(Input,'test.in'); Reset(Input);
      	Assign(Output,'test.out'); Rewrite(Output);
      		
    • At the end of the main program, before the end. declaration, make sure there is
      	Close(Output);
      		

  • Example Program:

    	program Welcome;
    
    	uses WinCRT;
    
    	var
    	  name: string;
    
    	begin
    	  Assign(Input,'pn3.in'); Reset(Input);
    	  Assign(Output,'pn3.out'); Rewrite(Output);
    
    	  Readln(name);
    	  Writeln('Welcome to Turbo Pascal for Windows, ',name);
    
    	  Close(Output);
    	end.
    	
    Items in cyan are the needed additions for file I/O using standard I/O commands.

  • Judges Information:

    • Delete C:\TEMP\test.*
    • Open Borland Turbo Pascal and create a TEST.PAS file
    • Copy the student's source from their submitted file and paste it into the TEST.PAS
    • Copy the Judge Data for the particular problem from J:\ to C:\TEMP\test.in
    • Look for the I AM USING FILE I/O comment. If it is present, skip this section:
      • Make sure there is a uses WinCRT; section
      • Add the following two lines just after the begin of the main program (if they aren't already there):
          Assign(Input,'C:\TEMP\test.in'); Reset(Input);
          Assign(Output,'C:\TEMP\test.out'); Rewrite(Output);
      • Add the following line just before the end. of the main program:
          Close(Output);
    • Select Compile | Build
    • Select Run | Run
    • Use NotePad or WordPad or Pascal to view the output file C:\TEMP\test.out to determine if the solution is correct

Return to the Top of Page, Index Page, Novice Problem Set, or Veteran Problem Set.

Microsoft QBasic

    NOTES  |  File Naming Conventions  |  To Make It Work  |  Example Program  |  Judges Information

  • NOTES:

    • Write your code to do keyboard input(INPUT) and ouput (PRINT).

  • File Naming Conventions:

    • All source submissions should have a file naming convention of p[n|v]<num>.bas where:
        [n|v] refers to either novice or veteran
        <num> refers to the problem number
      For example, if you are a novice team working on problem 3, your filename would be: pn3.bas
    • If you decide to do file I/O instead of INPUT - PRINT, your input file must be test.in and your output file must be test.out. If you do file I/O, put a comment just above the main function that says:
      
      		REM ***********************
      		REM * I AM USING FILE I/O *
      		REM ***********************

  • To Make It Work:

      Refer to the other sections of QBasic.

  • Example Program:

    DIM cows AS INTEGER
    DIM total AS INTEGER
    
    total = 0
    INPUT cows
    WHILE (cows > -10)
    	total = total + cows
    	INPUT cows
    WEND
    PRINT "A herd of ",total," cows."
    END
    

  • Judges Information:

    • Copy the submitted .bas to C:\TEMP\test.bas
    • Copy the Judge Data for the particular problem from J:\ into C:\TEMP\test.in
    • Open a Command Prompt and cd C:\TEST
    • See if the I AM USING FILE I/O REMark is present. If it is, run their program with:qbasic /run test.bas, if it is not, run their program with: qbasic /run test.bas < test.in > test.out
    • Use NOTEPAD or some other editor to compare their output with the Official Judges Output NOTE: The output will have the input of the problem intermingled with the output (a ? before each input). This is the nature of capturing QBasic's output through this manner - we get the output and the echo of the input.

Return to the Top of Page, Index Page, Novice Problem Set, or Veteran Problem Set.

Microsoft Visual Basic v5.0

    NOTES  |  File Naming Conventions  |  To Make It Work  |  Example Program  |  Judges Information

  • NOTES:

    • When you create your project, just select the standard.exe, not a GUI. Use only one form for your application. Submit only your form file (we just need the form source-- not the whole project).

  • File Naming Conventions:

    • All source submissions should have a file naming convention of p[n|v]<num>.frm where:
        [n|v] refers to either novice or veteran
        <num> refers to the problem number
      For example, if you are a novice team working on problem 3, your filename would be: pn3.frm

  • To Make It Work:

    • Make sure to Open a local textfile for your input. We will be using command-line based redirection for testing. Also, you'll need to Open a second stream for local based textfile output. See the Example Program below.

  • Example Program:

    	Private Sub Form_Load()
    	Close #1
    	Open "c:\temp\a.a" For Input As #1
    	Dim b As Integer, c As Integer, d, e, f As Integer
    	Dim aa As Integer, bb   As Integer, cc As Integer
    	b = 1
    	While b <> 0
    	Input #1, b
    	Input #1, c
    	f = b * c
    	Open "c:\temp\b" For Append As #2
    	Print #2, f
    	Close #2
    	Wend
    	Close #1
    	Unload Me
    	End Sub
    	

  • Judges Information:

Return to the Top of Page, Index Page, Novice Problem Set, or Veteran Problem Set.

Microsoft Visual C/C++ v5.0

    NOTES  |  File Naming Conventions  |  To Make It Work  |  Example Program  |  Judges Information

  • NOTES:

    • When creating a new project, make sure you select Win32 Console Application for the project type!
    • When creating a new source file, choose C++ Source File and let it append a .cpp to your filename (this works even if you only code in C).
    • The only types of files in your project should be C/C++ Header File and/or C++ Source File.
    • Name the project and source file according to the File Naming Conventions below.
    • Your project should have one .cpp file and may optionally have one matching .h file.

  • File Naming Conventions:

    • All source submissions should have a file naming convention of p[n|v]<num>.cpp where:
        [n|v] refers to either novice or veteran
        <num> refers to the problem number
      For example, if you are a novice team working on problem 3, your filename would be: pn3.cpp
    • If you decide to do file I/O instead of STDIN/STDOUT, your input file must be test.in and your output file must be test.out. If you do file I/O, put a comment just above the main function that says:
      
      		/**********************
      		* I AM USING FILE I/O *
      		***********************/

  • To Make It Work:

    • Under the Build menu, select Rebuild All to compile.
    • Under the Build menu, select Execute <filename> to run.

  • Example Program:

    	#include <stdio.h>
    
    	void main()
    	{
    	 char name[80];
    
    		printf("What's your name? ");
    		scanf("%s",name);
    		printf("\nHello World!, %s\n",name);
    	}
    	

  • Judges Information:

    Steps to Judge
    • Delete the old test project (you won't have to do this the first time) from the C:\TEMP\ directory with Windows Explorer
    • Make a new Win32 Console Application test project in the C:\TEMP directory.
    • Add a new judge C/C++ source file to the project.
    • Paste user's source code into the source document.
    • Build (it saves the compiled version to disk in the C:\TEMP\TEST\JUDGE\DEBUG directory).
    • Switch to a DOS window.
    • cd to the C:\TEMP\TEST\JUDGE\DEBUG directory.
    • Copy the input datafile from C:\TEMP to this same directory.
    • Run the program by: filename.exe < inputfile > outputfile
    • Use Notepad to open the outputfile and compare it with the provided Solution Docuentation

Return to the Top of Page, Index Page, Novice Problem Set, or Veteran Problem Set.



The statements and opinions included in these pages are those of the LSU Computer Science High School Programming Contest Staff only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.

© 2000 LSU Computer Science High School Programming Contest

This page last updated 2001/04/05 20:28:40.