Lab 11A: C-style Strings

  < Previous  Next >

Objectives:

In this lab, we will practice:

Assignment:

Write a simple C++ program that does the following:
  1. Declares a C-style string named oldSchoolString and initializes it to "low overhead". (Calculate, in your head, how many bytes it requires.)
  2. Calculates (so not a hard-coded value) and displays how many bytes oldSchoolString actually requires
  3. Appropriately use at least 3 functions from the cstring header file
  4. Display a statement about the pros and cons of using C-style strings compared with C++ strings.

Submission

Submit your source code using the handin program. For handin, for this lab, type the following in a terminal window exactly as it appears:
handin  lab11A  main.cpp
To verify your submission, type the following in a terminal window:
handin  lab11A

Rubric:

Points  Item
------  --------------------------------------------------------------
10      Documentation
        Header comment block at the beginning of each file with:
        + Your full name
        + Date(s) code was written
        + Description
        Comments explaining the role of each variable and major section of code

40      Correctness
        Program solves the assigned problem using methods described in program description
	+ Declares and initializes a C-style string
	+ Computes and displays the number of bytes needed
	+ 3+ cstring functions
	+ Pros and cons statement
        Program compiles without errors
        Program executes without crashing
        Program produces the correct output
------  --------------------------------------------------------------
50      Total