Help me with C++
Go to solution
Solved by Eigenvektor,
11 minutes ago, HotLoli42069 said:changing the variable and adding == operator did work, but now it does not show the output in the condition.
if (anime=="oshi no ko") { cout << "Thats great!"; }please help this little boy.
As I said above, you generally cannot compare strings with == in C++. This condition would only be true if the variable anime and the constant string "oshi no ko" refer to the same instance (which isn't possible here).
You need to use something like
if (strcmp(anime, "oshi no ko") == 0) { ... }
which will compare the contents of the strings, rather than their instances.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now