Course introduction

Objectives

  • Find course information on syllabus
  • Use Desire2Learn resources for course
  • Review some basic Linux/UNIX commands
  • Write, compile, and run programs on a remote Linux server
  • Set up user accounts on a Linux server

Preliminaries

  • CIS 250 Syllabus
  • CIS 250 Honors Syllabus
  • Honors Project
  • review Desire2Learn resources
  • set up accounts on kermit for working on programs
  • review how a C++ compiler works (g++)
  • coding style and conventions will have to be followed
    • these will be discussed as the semester progresses
    • rudimentary style basics:
      • indents should be four spaces per indent level
      • tabs must not be used for indentation
      • variable names should start with a lowercase letter
      • do NOT use: using namespace std;
      • names of constants should be all uppercase
      • global variables are not allowed
    • Comments including name, course, assignment number, and date must be included at the beginning of each program
    • GeoSoft C++ style guidelines
  • cplusplus.com: great C++ reference

Getting to your server account

You don't have to be a Unix/Linux expert to do your work in this course, but you do have to know some basics since your programs have to be submitted, compiled, and running on a Linux server. Ask if you have any questions about using Linux during the course.

  • Your account is on kermit (kermit.kish.edu)
  • kermit is a Linux server
  • kermit requires ssh for secure terminal communication
  • You can use ssh from a Linux/Mac computer to hook up to kermit
  • You can download putty to communicate with kermit from a Windows machine
  • Your username and password are the same as for other online school resources

Basic Linux/UNIX commands

  • pwd: display the current directory name
  • cd dirname: go to the directory named dirname
  • cd: go to your home directory
  • rm filename: delete the specified file
  • mkdir dirname: create a directory named dirname
  • rmdir dirname: delete a directory named dirname
  • ls: display a list of the files in the current directory
  • exit: exit current shell
  • logout: logout from kermit
  • nano filename: a useful text editor on kermit
  • man cmd: get help on the command named cmd
  • passwd: used to change your password
  • mv source dest: move (rename) source to dest
  • cp source dest: make a copy of source and name it dest
  • chmod 600 filename: restrict a source file so only you can read/write it
  • chmod 700 directory: restrict a directory so only you have access
  • other commands will be covered as needed or as requested

Compiling your first C++ program on kermit

  • all of your work should be done in a directory named cis250
  • make a separate directory for each assignment
  • let's do a simple Hello program
  • login to kermit
  • create a new cis250 directory if needed: mkdir cis250
  • move to your cis250 directory: cd cis250
  • create a new directory for the hello project: mkdir hello
  • move to the hello directory: cd hello
  • start nano to create the program: nano hello.cpp
  • Type in a simple "Hello world" program
  • save the file (Ctrl+O) as hello.cpp
  • exit nano (Ctrl+X)
  • compile your program: g++ -o hello hello.cpp
    • the -o option goes just before a filename; a filename with that name is where the compiled code will be put
    • the last name is the name of the file to compile
    • Note: You will wipe out your source file if you type: g++ -o hello.cpp hello.cpp
  • run your program: ./hello

Example code for Hello World