First, you do realise that you can use the code tags in the format bar to make the code in 'colour' on the website? Also, please use a sane indentation scheme...
Your problems are multiple. Firstly, you are using 'sum' before you gave it a value, so it should be giving you random junk. Now, you are also trying to store a letter ('d') in an integer, so the failbit for cin is set and it ignores all following attempts at input. Here is your code fixed:
#include <iostream>
#include <string>
int main() {
// please use 'sensical' variable names
std::string todo;
int choice;
std::cout << "What would you like to do today? ";
std::cin >> todo;
std::cout << "So you want to " << todo << std::endl;
std::cout << "Yes [1] or No [2]? "
std::cin >> choice;
if (choice == 1) {
std::cout << "Oh, that sounds awesome!\n";
} else {
std::cout << "Then, goodbye.\n";
}
return 0;
}
You changed his "std::string todo" into "int todo".
An int can store any whole number, positive or negative, but that is all. A string can hold multiple characters. When you try and read in "Nothing" you need to store it into a variable capable of storing a string.
Your code also will currently not work because cin will only look at one character at a time. Reading in the word "Nothing" into some string variable and then printing that variable would result in "N". If you want to read in more than one character at a time you must use getline. Googling the phrase "Cplusplus getline" should lead you to some examples.
Hopefully that helps
EDIT:
may have misrepresented cin. I was thinking of reading in white space separated words into one string. Getline isn't necessary here but it's still useful to know about.
I had a typo in my code - line 14 I was missing the semicolon. In your most recent example, you were copying into an integer rather than a string as in my code. If you aren't satisfied, here is my code compiled: http://coliru.stacked-crooked.com/a/b79b98493d029aa6
As I mentioned in my edit cin will only read in until it hits whitespace. To read an entire line you can use getline.
The rreason everything happens at once is it reads up to the space for the first cin, and then it sees more input left to read in, the second word, and uses that for the second cin. It resulted in an error because it tried to read "life" into an int.