Table of Contents:
Return to Top of Page
uses WinCRT;
Assign(Input,'input.txt'); Reset(Input); Assign(Output,'output.txt'); Rewrite(Output);
Close(Output);
program Welcome; uses WinCRT; var name: string; begin Assign(Input,'input.txt'); Reset(Input); Assign(Output,'output.txt'); Rewrite(Output); Readln(name); Writeln('Welcome to Turbo Pascal for Windows, ',name); Close(Output); end.Items in red are the needed additions for file I/O using standard I/O commands.
Return to Top of Page
program practice; uses Forms; {$apptype console} var name : string; begin readln(name); writeln('Hello ',name); end.Items in red are the needed additions.
Return to Top of Page
C:\temp\practice>qbasic /run prac.bas < input.txt > output.txtThis will work assuming the following:
rem Practice Problem input name$ print "Hello ", name$
Return to Top of Page
where MYPROG.vbp is your project file.( You should have at least two files: a .vbp file and a .bas file. This will produce a file called MYPROG.exe.
Private Sub Main() Close #1 Open "input.txt" For Input As #1 Open "output.txt" For Append As #2 Dim name as string Input #1, name Print #2, "Hello ",name Close #1 Close #2 End Sub
Type=Exe Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\WINNT\System32\Stdole2.tlb#OLE Automation Module=module; module.bas Startup="Sub Main" Command32="" Name="Project1" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="Louisiana State University" CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 [MS Transaction Server] AutoRefresh=1
Return to Top of Page
#include <stdio.h> int main() { char name[80]; scanf("%s",name); printf("\nHello %s\n",name); return 0; }
Return to Top of Page
import java.io.*; //include Java's standard Input&Output routines class practice { // start of class practice public static void main (String[] args) throws IOException { // method main // Defines the standard input stream BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); String name; name = stdin.readLine(); System.out.println("Hello " + name); } // method main } // end of class practice
Return to Top of Page