CIS 122 FAQ

  1. What if I missed my week 1 lab? During summer session it's really hard to get caught up! Plan to spend both lab office hours practicing with Emacs, as well as some time on your own. And don't miss any more. ;)

  2. What if I can't make the lab time?

    Unfortunately summer session is handled differently from the regular year, and lab sections are scheduled informally. Despite this, they are required. It is VERY unlikely that a student missing labs could survive the class. (Unless they had prior programming experience and plenty of time.)

  3. Should I bring my book to class each day? A good idea, since your instructor will frequently be covering examples taken from the book.

  4. What is an Emacs backup file?

    The emacs backup file If you accidentally destroy or remove a file you are working on, note that emacs automatically creates a backup file when you open a file. Emacs appends a '~' to the file name being edited; thus, the backup file for tempCon.cpp is tempCon.cpp~.

    Emacs makes a backup for a file only the first time the file is saved in each editing session. No matter how many times you save a file in Emacs, its backup file continues to contain the contents from before you started the current emacs session.

    If you damage or lose a file, simply open the backup file in emacs: "emacs tempCon.cpp~" and then write it out (cntrl-x cntrl-w) to the original name, tempCon.cpp (not tempCon.cpp~).

    Cancel Command: cntrl-g. If you type an emacs command you did not intend, the results are often mysterious. You can cancel a running or partially typed command with cntrl-g. Some commands take two successive c-g's to terminate.

    Redisplay the screen: cntrl-l ("el", not the digit "1"). If the data on the screen looks wrong, type cntrl-l.

  5. Why can't I use the name calc for an executable? Running "calc" starts a Unix program (unix calculator). Students can use the name "calc" if they run their program with the"./calc" command; or, by naming it something else like "myCalc".

  6. Where can I read more about Unix? You instructor has a "Unix Boot Camp packet": If you would like a well-written tutorial on how to become a unix power user, you can check out the packet from your instructor and make a copy.

  7. May I take CIS 122 P/N? Yes. 122 does not have to be taken for a grade to satisfy the B. Sci. math and computing requirement.

  8. How can I print the time in digital format?
    
    const char NUL = '\0';
    
    /* writeTime() ====================================
     * displays time in digital watch format
     */
    void writeTime(int hr, int min){
      cout << endl << ((hr < 10)?'0':NUL) << hr << ":"
           <<  ((min < 10)?'0':NUL) << min  << endl;
    }
    
    
    Note that this function is an exception to the general rule that functions do not use cout. Since the function is written specifically to perform output, it does use cout and the name of the function makes its purpose clear.

  9. How can I reverse the digits in a number?
    Algorithm dreverse
    
       prompt and read n
       reverse <- 0
    
       //reverse the order of digits in n
       while (n > 0)
          reverse <- reverse * 10      // shift accumulator left
          digit <- n  % 10             // copy rightmost digit of n
          reverse <- reverse + digit   // add digit on right end
          n <- n / 10                  // shift n right using INTEGER DIVISION
       od
    
    //display result
    print n, reverse
    
    End.
    

Home