Transitions to C++ project 1

Due: Thursday Jan 28th at 11:59pm

Summary:

This project is intended to get you used to our computing environment and starting to use C++. It is a very small C++ program, but if you wait to the last minute, frustration at learning the new environment in a limited time may prevent you from completing it.
Details section below is updated! find information on old c/c++ style strings at the bottom of the details section. see the heading for character strings in C++

Details:

You might find my introduction to working on Linux/unix at BSC page to be of use if you have not worked on our compute server before.


Create a new folder in your home directory for this project. Do all of your work in that folder.

Write a short "hello me" program in C++. Have the program prompt the user to enter his/her name, and then print out "hello X" with X replaced with the name that the user typed in.

Compile and run the program then write your readme.txt.

inside of your folder, you need to have a readme.txt with

when you have completed the program and the readme zip up the whole folder and submit it. (I recommend using konqueror to compress the folder. right click on the folder, choose the compress submenu, from there choose  one of the compress as options. Submit the compressed folder.

Character Strings in C++
Today C++ have a template class for strings. We will cover that class in a couple of weeks. In the meantime we will use the original c/c++ strings which are character arrays. In this old style string, the end of the text is denoted by a special NULL character. The null character is denoted as "\0" in a string in c++. (you can use the same \ escape sequences from java in your c++ strings.)

You can create an array as a local variable in c++ with the following syntax:

type variableName[size];

e.g.

char person[50];

will create an array of 50 characters named person. You can now access any element of the array (any character in the string) using the array reference operator []. C++ arrays use zero based indexing just like java arrays do.

e.g.
char firstInitial = person[0];
or even change a character in the array
person[5] = 'a';

You can also use the array as is with cin and cout.

cin >> person;

will put whatever characters the user types into the variable person. There are actually potential problems with this in the form of buffer overflow errors, but as long as the user didn't type more than 49 characters (remember you need one character in the array for the null terminating '\0' character.) the program will work fine.

Submitting

from the command line on csdev01, use the following line to move into my directory

cd /home/bscstaff/jsantore/onlineSubmit

then use this line to run the submit program:
./submit.sh &

This will pop up a window allowing you to choose your class (and possibly section) and the file to submit. When you have done so press submit and in a few seconds (longer if you submit a really large file) you will see a dialog pop up telling you your submission was sucessful.