CS 1500
Getting Started - Hello World!


Use this document as a tutorial to get accustomed to the class computing environment.
Read everything in this document before you start doing the tutorial it describes.


This document may use quotes ("...") to delimit the exact characters you must type to give a particular command to the computer. Usually you are not supposed to include these quotes in what you type. In the very few cases where you are supposed to type the quotes, the directions will say so explicitly.


If you are supposed to press the Enter key after typing a command, the directions will use the word enter. For example,

Enter "vt100"

means type "vt100" (without the quotes) and then press the Enter key.

  1. Getting an Account: If you don't already have an account on the CS Dept Sun Ultra and Mac network, then get a user name and password from your instructor.

  2. Finding a Machine: Locate an available Sun Ultra computer, or personal computer from which you can login remotely. Your instructor and/or a lab assistant can help you.
  3. Starting to Login: Some names of the lab Macs and Sun Ultra's are: ada, altair, arcturus, babbage, castor, ceti, chomsky, deneb, godel, hopper, linus, omicron, pascal, polaris, pollux, saiph, turing and wozniak. If you are doing remote login from a computer that is not a Sun Ultra, make a random choice and log in to one of the machines named above. If you need help logging in, raise your hand or consult the appropriate section of the handout entitled Gaining Access to Workstations in the Computer Science Department Network. (This document is available in the class web space under the file name loginDirections.html.)

  4. Entering Username and Password: To login, you enter your user name and password when prompted. The password you type will not show on the screen. This is normal. It is a security feature that helps prevent others from observing your password.

  5. Declaring a Terminal Type and Waiting for Login to Complete:
    If you are logging in remotely, then after you successfully log in, the system may ask you about your terminal type. This means the system needs to find out what kind of terminal control codes are being used. If you are asked about this, just enter "vt100". Then wait for the shell prompt to appear.

    The shell prompt will probably be your user name, followed by an "@" sign, then the name of the host you are logged into, then a colon, and then a few more characters. For example, if your user name were "jdoe" and you were logged into babbage, your shell prompt would be something like: "jdoe@babbage.csustan.edu:(~)". This prompt means that the Unix shell program is ready to accept a command.

    If you just sit down in front of one of the Macs or Sun Ultra's and try to login to it (it's called "logging in at a console"), you may see a panel asking about which graphical user interface (GUI) you want to use. If so, on the Suns be sure that Common Desktop Environment (CDE) is selected. Then wait until the graphic "desktop" appears. Next near the bottom of the screen, move the mouse arrow into the small square that is just to the left of the square containing the question mark (?). Then move to the little triangle at the top of the square and click on it. A menu titled "Hosts" should pop up. If that doesn't happen, raise your hand to get some help. Once you have the menu, click on "Console." The menu will retract, and a new window will appear with a shell prompt as described above.

  6. Changing Your Password: At this time, you can change your password. You just click somewhere in the middle of the window containing the shell prompt and then enter "passwd" After that, follow the directions on the screen.

    Before you enter the command, you must first think of a good password. Check out this advice on choosing a password.

  7. Starting the Editor and Entering Text:  Enter "pico prog1.cpp".

    (NOTE: In the name: prog1.cpp above, that is a 'one' after the 'g' - not the letter 'el').

    The command "pico prog1.cpp" starts up a text editor called PICO, working with a file buffer called prog1.cpp.

    PICO is a lot like some PC applications with which you may or may not be familiar: Notepad, TextEdit, or SimpleText. It is a simple text editor - better than a word processor for the kind of thing we are doing.

    Unless the file already exists, the screen goes blank, except for some documentation lines at the bottom. PICO is running. Type the following text. It is a very simple C++ source program. If there is already text on the screen, ask for help to erase it and then type the text below.

    #include <iostream>

    using namespace std;

    int main (void)
    cout << "Hello World!" << endl ;
    return 0 ;
    (NOTE: The final character in the "endl" above is the letter 'el' and not a 'one'. The "endl" stands for "endline".)
  8. Saving and Exiting: Now figure out how to use the keyboard to do this PICO command:


    What I mean by the command above is "while holding down the ctrl-key with one hand, with the other hand press the x-key,  release the ctrl-key."  Then follow the instructions: enter "y" to save and edit the name of the file if necesary. C++ programs for the g++ compiler on the Suns are supposed to have names ending in ".cpp" or ".cc". In other words, they should have names like prog1.cpp, myprog.cc, prog3.cpp, and so on. This is very important. If the ".cc" or ".cpp" is missing, the compiler or linker may fail, even though the program has no errors.

  9. Compiling and Linking: Next enter "g++ prog1.cpp". This is the command that compiles (and links) your program. It tells the compiler (g++) to translate prog1.cpp into a machine-language version of the program.

  10. Checking for Errors and Executing the Program: If you got an error message, it probably means that you made a mistake when you typed the program. In that case, fix it: go back to step #7. If there were no errors in your program, then your compilation succeeded, and the name of the executable translation of the program is "a.out". In that case, enter "a.out", to execute the program. You should see the message "Hello World!" that your program prints on the screen. Did you see it? If so, give yourself a pat on the back. You just wrote a C++ program, and (this is the really important part) it does what it's supposed to do.

mmartin@soleil:(~/1500) g++ prog1.cpp
mmartin@soleil:(~/1500) a.out
Hello World!