CS-240

Lab 1

Purpose: Familiarize the student with program development using the Linux command line environment and several useful Linux/Unix commands.
Method:

Do the following:

  1. Upon entering the lab log on using your PODS userid and password. You will be logged into a Debian linux environment. To get to a command line environment locate a terminal icon or menu choice and select it, this should open up what is known as a terminal window which gives you a linux command line environment. On the surface, this looks like the Windows command environment (remember, Unix came before DOS and is what DOS was modeled after). The Linux help system is accessible through the system "man" pages. This is standard on all Unix/Linux distributions. "man"is short for manual (but the command is "man"). To look up the help for a particular command type and the command "man" (without quotes) followed by the command you are interested in followed by the ENTER key.
    For example to look at the help for the "pwd" command type
    man pwd

    This will open up the man program and display the help for the command you asked for. In the man page environment, togo forward to look at additional information depress the enter key. To exit the man page program type the letter "q".
    Explore the man pages for the following commands; using your own words write definitions for what each does (submit this text file as part of the Lab, name the file definitions.txt).
    • man
    • pwd
    • mkdir
    • rmdir
    • cd
    • ls
    • find
    • locate
    • g++
  2. While in the lab write a "HelloWorld" program (one will be gone over in class). Use the nano editor (or gedit) program to create the source file in your home directory (when you use the lab machines your "home" directory is your bingsuns account). Hint = the source file must be type .c or the compiler won't recognize it. To compile the source file:
    To compile your helloworld.c file type:
    gcc helloworld.c -ohelloworld.exe

    fix any errors that the compiler may detect by editing the source file. When everything is OK (i.e. no errors) run your program by typing:
    ./helloworld.exe
  3. Write a short program what will allow the user to enter an integer and will print out the binary equivalent as a 32 bit binary number. (This doesn't require any arrays or division). Name the program "PrintBinary". Demonstrate that it runs.
  4. FTP all of the files to the lab1 directory of your FTP account on the bigblackbox.cs.binghamton.edu server. This should include:
    • definitions.txt
    • helloworld.cpp
    • PrintBinary.c
Submission:

When your lab is ready for grading send a note to your TA/CA indicating your lab is ready for grading (make the subject of the note "Lab1 ready" followed by your last name.



Last updated 02/04/2010 - RVS