Professional Documents
Culture Documents
The C++ language was developed by Bjorn Stroustrop as a means by which he could incorporate
objects and the object centered paradigm into C, a procedural language. Because it is built on
and utilizes many aspects of C, the study of C++ requires knowledge of and facility with much
of the underlying language. Such knowledge includes:
1. Variables and variable types.
2. Pointers, pointer types, and their values.
3. Program structure.
4. Basic data structures such as the array and struct.
5. Functions and passing data or pointers to data into a function.
6. Flow of control such as branching and looping.
7. Program Input and Output.
Such knowledge of C can be acquired in a variety of ways including self-study, taking courses in
the C language, or taking a C++ course that incorporates the C background material.
The following thirteen projects are written to assess basic knowledge of each of the core aspects
of the C language listed above that are considered essential to the successful study of the C++
language. Completion of the thirteen projects should take less that one hour.
C Skills Assessment Projects
2. Declare, define, and initialize three variables, one of type int, one of type float, and one
of type char. Initialize the int to 5, the float to 2.147, and the char to ‘e’.
Declare, define, and initialize three pointers, one to each of the variables.
Print the three values, through the three pointers, to the display.
Arrays
3. Declare, define, and initialize a 5 element integer array to the values 1, 1, 2, 3, 5. Print
the value of the entry at each index of the array to the display. Do not use any iteration
constructs.
Structs
6. Declare and define a struct that contains three variables, one of type int, one of type float,
and one of type char. Assign the value 5 to the int, 2.147 to the float, and ‘e’ to the char.
Print the three values to the display.
9. Declare and define a struct that contains three variables, one of type int, one of type float,
and one of type char. Assign the value 5 to the int, 2.147 to the float, and ‘e’ to the char.
Pass the struct into a function, printStruct, by pointer. In the function, print the value of
each element in the struct to the display.
Program Structure
10. Decompose the solution in question 7 into a multiple file program. Let one file contain
the main routine, a second contain the function implementation, and a third contain the
header information. Execute the program.
Basic I/O
11. Prompt the user to enter his or her given name followed by their family name. Accept,
then print the user’s given and family names to the display.
12. Prompt the user to enter a number between 0 and 100. If the user’s number is greater
than 50, print the word big to the display otherwise print the word small.
13. Declare and define a 5 element array. Using a for loop, prompt the user to enter 5
integers, one at a time; enter each into the array. After the last element is entered, exit
the for loop. Using a second for loop, print the contents of the array to the display.