Unformatted text preview:

CSE 2341 Fall 2008 Lab 1 Activity Sheet Lab 1 Activity Sheet 3 Create a directory named lastName Lab1 mkdir Purpose for Lab 1 To make sure you have the basic skills you will need through the rest of the semester E g EtchisonLab1 and move into this directory cd 4 You need to create the three files shown in Appendix 1 You may download them to windows By the end of this lab you will be able to and ftp them to your new Unix directory winscp 1 Perform basic functions in UNIX mkdir cd zip The files can be obtained at http engr smu edu cse 2341 Lab1 zip They are edit stored in a zip file Lab1 zip In your directory 2 Do a multi file compilation you can extract the files from this archive by 3 Debug any program typing unzip Lab1 zip See the Unix Cheat Sheet in 4 Upload your work to Blackboard You must have a School of Engineering Login and password for both the Windows environment and the UNIX environment If you temporary IDs are available cannot login today Send an email to help engr smu edu to get your login information The temporary IDs will be disabled sometime during the 2nd week of class 1 5 In the past you probably only compiled one source file for each of your programs All the programs in this class will require you to compile more than one source file So you need to pay close attention use for 2341 ask your lab assistant by starting a start run telnet TestClass cpp MainDriver cpp Here are some things you need to 2 Log into one of the UNIX machines that you can using Exceed 2 6 At the UNIX prompt type g 1 Log into Windows session Multi file Compilation to this step Prepare Code Files telnet Appendix B for more info machine or notice about this 1 You don t include h header files in the g compile line The linker automatically Only include will files handle this with cpp 1 CSE 2341 Fall 2008 Lab 1 Activity Sheet extensions You ll lean more about what goes in Question What is the difference between a syntax error these different files later and a bug 2 If you want to compile all the cpp files in the current directory and they are all part of the 8 Here are some tips to detect syntax errors If it is a short program scan through to detect same program type g cpp try this with syntax the files you created Sometimes the compiler will help you by giving errors like missing semicolons 3 Remember if you want to rename the output of you line numbers But often an error on one line the compilation to something other than a out may be due to a mistake on a previous line so you need to use the o flag in the compilation scan the surrounding lines command So for these files you could do something like Solve one problem at a time starting with the first error found by the compiler or several that g cpp o Lab1 out you recognize and are easy Recompile your You have probably noticed that the compiler is program Often one simple error at the top of screaming at you thanks to some bugs planted in the your program will lead to many errors later on code by a certain evil TA In the next step you will debug the program Debug Your Program Learn the messages your compiler returns for different errors Each message means 3 7 When your program works properly it will prompt you for your name and then print out a scrambled encrypted version of your name If you enter the name Lab it should output Qfg something you will probably encounter the same messages over and over again throughout the semester A common error is when the compiler does not recognize a variable or datatype you use in your program Ask yourself Where do I tell the If your program is not doing this then it is not compiler about this variable Go back to that correct even if it compiles successfully There declaration prototype declaration or include are about 22 syntax errors and bugs in this and look for syntax errors program Try to isolate the error by commenting out portions of code and recompiling If you get no 2 CSE 2341 Fall 2008 Lab 1 Activity Sheet errors or get a different error go back and also bugs because it can potentially mislead look for syntax errors in the code you just someone who uses your code later commented out Sometimes the compiler issues a warning but 9 Here are some tips to detect bugs compiles successfully Usually you should pay The most powerful tool for detecting bugs is the cout statement statements to test Temporarily the value insert of cout variables Calculate by hand what you think the variables should be Sometimes a block of the code e g a loop never gets executed because the conditions for entering the block are never met Use an appropriate cout statement that says something like I got to the xxx function to verify that certain parts of code are being executed is different from Often the compiler will not pick this up but your program will not work correctly Make sure the program does what it is attention to these warnings and try to find the root cause This may require digging into reference books Above all do not lose hope No error is impossible to detect No bug is impossible to find It may take a while but keep using some of the steps above and you are certain to find the misdeed Upload Your Program 4 10 When you succeed 11 If you are satisfied that everything is in working order you need to compress your files into one file before you transfer them to the windows environment You can alternatively compress your files in the windows environment if you know how supposed to do This may seem trivial but to use WinZip or some other compression utility companies have lost millions of dollars because Follow these steps to compress in UNIX of this bug Your user interface is important Technically a user interface that does not make sense to the user or that has spelling mistakes is a bug Use newline characters to make your interface presentable Mistakes in the documentation are a Move up one directory cd b Type zip r Lastname firstInit Lab1 zip directory e g zip r EtchisonJLab1 zip AyewahLab1 See the course outline for specifics on the 3 CSE 2341 Fall 2008 Lab 1 Activity Sheet naming convention that is required for your zip files for regular assignments 12 Using WinScp transfer the compressed file to your Windows Machine 13 Upload that compressed file to Blackboard in the Lab1Exercise folder 4 Appendix 1 The 2341 Name Encrypter 3 source files File MainDriver cpp MainDriver cpp This file is used for CSE 2341 Lab 1 It will use the library TestClass h to be able to instantiate a …


View Full Document

SMU CSE 2341 - Study Guide

Loading Unlocking...
Login

Join to view Study Guide 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 Study Guide 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?