After my searching and discussing wif my fren, to compare string i need to use strcmp but that is if i want to compare the whole sentence. What i want to do is like this:

user input sentence 1: this is my house
user input sentence 2: this is my car
user input sentence 3: my car is red
user input sentence 4: my car is blue

Output file:

1| this is my
2| my car is

1 my house
1 his car
2 red
2 blue

i want to compare word by word from the sentence that the user input. im in lost right now and any suggestion or help would do.

look up stringstream. In particular you can create a stringstream from the input sentence and then "read the sentence word by word" by writing it to a holding string using the >> operator to parse the input by whitespace char (the space and newline chars in your case)