wrong test case

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

#include <iostream>
#include <string>

using namespace std;

int main(){

  int n;
  cin >> n;
  if(n == 1){
    cout << "I hate it" << endl;

    }
    else if(n == 2){

      cout << "I hate that I love it" << endl;
      
    }

    else if(n == 3){

      cout << "I hate that I love that I hate it" << endl;
    }
    
  return 0;
}
Last edited on
It is impossible to know why it fails when we don't know what your program is supposed to do.
tdleanz,

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.

Hope that helps,

Andy
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.....

I hope you write the perfect emotion code now

HOPE IT HELPS
Last edited on
Topic archived. No new replies allowed.