Unformatted text preview:

DOING THE HELLO WORLD PRACTICE ASSIGNMENT DIRECTIONS Use this document as a tutorial to get accustomed to the class computing environment This is NOT an assignment for credit Read everything in this document before you start doing the tutorial it describes Quotation marks are used in this document for a variety of purposes In several cases it is done to indicate the exact characters you are supposed to type in order to give some particular command to the computer Generally you are NOT supposed to include any quotes in what you type In the few cases where you ARE supposed to type 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 Commands typed while the editor JOVE is running are NOT usually completed by pressing the Enter key TUTORIAL 1 If you don t already have an account on the CS Dept Sun Ultra network then get a user name and password from your instructor 2 Locate an available Sun Ultra computer or personal computer you can telnet from Your instructor and or a lab assistant can help you 3 The names of the Sun Ultras are altair castor pollux rigel vega capella regulus soleil zaurak saiph and spica If you are telnetting in from some computer other than a Sun Ultra make a random choice and log in to one of the machines named above If you need help logging in consult the appropriate section of the handout entitled Gaining Access to Workstations in the Computer Science Department Network 4 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 If you are telnetting 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 Page 1 of 5 prompt to appear The shell prompt will be your user name followed by an sign then the name of the host you are logged into then a colon and then a tilde For example if your user name were jdoe and you were logged into zaurak your shell prompt would be something like jdoe zaurak This prompt means that the Unix shell program is ready to accept a command If you logged in at a console wait until the graphic desktop appears Then 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 Optional step At this time you can change your password by entering nispasswd at the shell prompt and then following the directions on the screen Before you enter the command you must first think of a password that is at least 6 characters in length contains at least two alphabetic characters and at least one numeric or special character A password needs to be easy for you to remember but hard for anyone else to guess Unfortunately it is likely that hackers will be trying to break into your account Basing your password on two unrelated words separated by punctuation is a good idea Examples greeni dea m0Le pen Also you can think of a favorite saying and base the password on the use of the first letter of each word For example A poem as lovely as a tree could become apaLA1t Don t use any of these particular examples though you need to make up a password known only to you 7 Enter jove p1 cpp This tells the computer to run the editor called jove and that you want to work on a file called p1 cpp If the file does not already exist jove will create it Unless the file already exists the window will now go blank except for some documentation lines at the bottom Jove is now running Type the following text It is a simple C source program If there is already text in the window change it to the text below include iostream h int main cout Hello World endl return 0 Page 2 of 5 8 If you haven t done so already consult the legend on your copy of Jove a quick reference guide and figure out how to type codes like C f or M x Now do C x C The Cx C command causes a copy of the program you typed to be saved It is saved as a file named p1 cpp because of the name you typed in step 7 A C program for the g compiler on the Suns is supposed to have a name ending in cpp or cc In other words it should have a name such as p1 cpp myprog cc prog3 cpp and so on This is important If the cc or cpp is missing the compiler or linker may fail even though the program has no errors 9 Now do C x C c This exits the editor Next enter g p1 cpp 10 If you got an error message it probably means that you made a mistake when you typed the program In that case go back to step 7 and fix it 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 If you see that congratulations You just wrote a program and executed it successfully 11 Now that you are sure the program is working correctly let s do another test This one will be for the record Enter script p1 script and wait a moment The command executes the script program The script program makes a record of whatever is typed in your console window The record is placed into a file with the name you specified p1 script When your prompt is written on the window again you are ready to begin the recording Enter a out and see your Hello world message written out on the window Now enter exit to turn off the scripting program From the time you entered script p1 script to when you entered exit all things that were written on the window by either you or the computer were also recorded in a file called p1 script Enter cat p1 script …


View Full Document

STAN STATE CS 3100 - Hello World Exercise

Documents in this Course
Load more
Loading Unlocking...
Login

Join to view Hello World Exercise and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Hello World Exercise and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?