rather than just giving him a working program, it would be a much better learning experience if you walk him through each of the changes you made to the code.
the strcmp function compares 2 strings (in this case input and GrapeC) to see if they are the same. if they are, the function returns 0, and if they are not it will return a number other than zero. you can google strcmp to see specifically what it outputs if the strings are not equal, but for this program that isn't necessary to know.
\b is what's called an escape character or escape sequence. there are about a dozen or so different escape characters, as shown in this chart:\a Bell (beep)
\b Backspace
\f Formfeed
\n Newline
\r Return
\t Tab
\\ Backslash
\' Single quote
\" Double quote
\xdd Hexadecimal representationbasically, when C++ reads the string it replaces these with a specific character. for example, if you execute this line of code:
cout << "blah blah \n more blah blahit will show up in the terminal as blah blah
more blah blahbecause the \n in the original string was replaced with the newline character. these can be useful when you need to output something in single or double quotations, because if you tried to execute this:cout << "My favorite quote is "blah blah blah" << endl; you would get all kinds of errors because of the "s. in RandomHero's code, the \b has the same effect as if you had pressed the backspace key. (to be honest, I don't know why he did it that way...)
finally, about cin.get(). basically all this function does is retrieve one character from the input stream. if you wanted to do something with that character, you could assign it as such:
char ch = cin.get();In our case though, we aren't assigning it to anything..so what's the point in including this? the most common way I see this function used is to keep the console window open after the main part of your program has finished executing. depending on the compiler that you use, the console window may or may not close upon successful execution of the program. some compilers (eclipse for example) have a built-in console, so this is not an issue. but for most compilers the console closes once the program has executed, which can be problematic if you need/want to see the output of the program. since there is nothing in the input stream when it is called, cin.get() waits until something gets put into the stream (aka the user hits enter, or almost any other key on the keyboard), and then retrieves that character. again, since we aren't assigning that character value to a variable, it is useless to us..but that's ok. basically the function makes the program stall out until the user presses a button.
let me know if any of this is confusing, I'd be more than happy to explain it further. good luck!