Lab 6
CS 1005, C-term 03
February 26, 2003
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').
- Sign the attendance sheet.
- Copy the partially-completed program into your directory:
cp /cs/cs1005/labs/lab6/lab6.cxx .
- 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.
- 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??
- Use the script command to record your program running. Name your
script file lab6.script.
- 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
- Good luck with your final exams!
Glynis Hamel
2003-01-17