Doing this code force challenge. I am passing three tests, I'm guessing when user enters numbers 1, 2, or 3, but I am failing the 4th test and I can't figure it out. Is it because I am not checking to see if 4 is entered? Here is the code I have so far. And here is the problem: http://codeforces.com/problemset/problem/705/A
#include <iostream>
#include <string>
usingnamespace std;
int main(){
int n;
cin >> n;
if(n == 1){
cout << "I hate it" << endl;
}
elseif(n == 2){
cout << "I hate that I love it" << endl;
}
elseif(n == 3){
cout << "I hate that I love that I hate it" << endl;
}
return 0;
}
Do not understand what your problem is? You have full filled the requirements of the assignment and the program works fine as is.
Although I will suggest that between lines 9 and 10 you should put an output statement to tell the user what input you are looking for. And after the cin>>n is a good place to deal with bad input.
So if there is something about test 4, you need t let us know what that is.
Like the movie inception The hulk has layers of feelings
So IMO the program should be like layers
1-hate
2-hate-love
3-hate-love-hate
4-hate-love-hate-love
5-hate-love-hate-love-hate
and so on......
You see there's hate within love and love within hate and so on....
Just like the movie Inception where there's a dream within a dream within a dream and so on.....