This project is very simple modification of the standard “hello world” program, which gathers user input to construct the response. The main point is for you to spend a little time getting comfortable with the tools, making sure you know how to do the basics of compiling and linking, and starting to get you a tiny bit familiar with C++.
Your assignment is just to modify the simple “hello world” program so that it collects some information from the user, and then echoes a more personal greeting, modeled after a famous line from The Princess Bride. Here’s what a transcript of your program should look like:
Enter your name:
Inigo
Enter a relative:
father
Hello. My name is Inigo. You killed my father. Prepare to die.
Your program asks for the name, and relative, stores the responses, and prints the greeting line at the end. That’s it. Pretty easy, right? Hopefully so. Note: if you want to collect names / relatives with whitespace, e.g., “Inigo Montoya”, or “great grandmother’s second cousin”, then you’ll want to use getline(cin,stringname) rather than cin >> stringname, but it is not required to do so.
You may want to start with a template that looks something like this:
1 | |
Make sure you know what each of the lines does (more or less). The <string> library provides you with the string class, surprisingly enough. Use a variable of this type to store the user’s name. Recall that the <iostream> library provides you a way to access standard input and output.
It might be a good idea to follow along with the tutorial on building from the command line as you’re doing this assignment.
Turn your assignment in here. A few important notes:
hello.cpp). If you turn a file with a different name, it will not be graded.Since your reading this, you have managed to clone the repository:
hg clone https://hg@bitbucket.org/wes_ccny/csc103_projects
Congratulations :D However, in the future, don’t run clone again. Instead, take the following steps, which will add my changes (usually just adding new files for the next project).
cd csc103_projects Make sure you are in the top directory of the repository (note: actual location may differ for you.)hg commit Make sure you don’t have any uncommitted changes sitting around in your working directory.hg pull This will download my changes into your local repository, but will not change any files in your working directory. So, unless you dig around in the .hg/ directory, you won’t really be able to tell anything has happened.hg merge This will combine my changes (usually just adding new files) with all the work that you have done, bringing your working copy up to date.hg commit -m "merging new changes from wes" This finally commits the changes resulting from the merge.