CSCI 151 Introduction to Computer Science, Fall - 2007

Assignment 2 Instructions

  • Create a directory Assign2 under your CSCI151 directory: while you are in your home directory, do the following:
    cd CSC151
    mkdir Assign2
  • Create a separate file (source file) for each program that you have in Assignment 2 - you will have 6 programs,
    you can call your files prog1.c, prog2.c, ...
    or you can choose some other names according to your choice.
    I will assume that the programs are called prog1.c, prog2.c, ...
  • Before you submit your assignment, compile and run each program and
    make sure that the program doesn't have any compilation errors and doesn't have any logical errors,
    and the program produces the right result.
  • To compile the first program do the following:
    gcc -o prog1 prog1.c
  • This command will create an executable file prog1 for your first program
  • You can run the executable file as follows:
       prog1
  • Compile and Run all 6 programs before you go to the submission step.
  • Important: the program that doesn't compile will receive 0 points

Submission of the Assignment 2

  • You will submit the printout of the source file for each program
  • To print the source file for each program, type the following at the LINUX prompt:

      lpr -Pnetlaser prog1.c or print prog1.c
      lpr -Pnetlaser prog2.c or print prog2.c
      lpr -Pnetlaser prog3.c or print prog3.c
      .........
      lpr -Pnetlaser prog6.c or print prog6.c