Lab 6

CS 1005, C-term 03

February 26, 2003

Problem

Write a function to double all the characters in a string. The goal of this lab is to give you practice in writing programs using strings. Remember that a string always ends with a null character ('\0').

What you should do...

  1. Sign the attendance sheet.

  2. Copy the partially-completed program into your directory:
      cp /cs/cs1005/labs/lab6/lab6.cxx .
    

  3. Complete the program by writing and calling a function which doubles all the characters in a string. Call the function with instring and outstring as parameters. The new string, with twice the number of characters, will be placed in outstring.

  4. Compile and run the program. Here is a sample execution.

     Please enter a string:	are we having fun yet?
     With letters doubled:  aarree  wwee  hhaavviinngg  ffuunn  yyeett??
    

  5. Use the script command to record your program running. Name your script file lab6.script.

  6. Use the turnin command to turn in your '.cxx' file for your program as well as your script file. Use the following command line:

    /cs/bin/turnin submit cs1005 lab6 lab6.cxx lab6.script
    

  7. Good luck with your final exams!




Glynis Hamel 2003-01-17