Problems using strings

I'm trying to make a function that makes you print the same sentence 5 times before you can move on. But basically my problem is that depending on how many words you input (with "cin >>") in the string, the same amount of words as you input will be printed out with cout. Also I want you to only be able to continue if you input the exact string "I'm not giving up". I'm new and confused.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    void AnnoyingFunction(){
	  int x = 0;
	  string x1;
	  string x12 = "I'm not giving up";
	  while ( x < 5){
		  cout << "This sentence will somehow print out as many times as there are words in the variable x12 " << endl;
		  cin >> x1;
		  if (x1 == x12){
			  x++;
		  }
		  else{
		  cout << "Something else text" << endl;
		  }
		  
	  }
cin >> x; will read a single word. Use std::getline to read the whole line.
Thank you
Topic archived. No new replies allowed.