Problem with printing strings

Nov 24, 2018 at 1:01am
This doesn't work for some reason. I don't know why, i hope i can get help. It prints nothing
this is just a snippet

1
2
3
4
5
6
7
  string input1
  string output1
  cin >> input1
  if (input1 == "11101000") {
	output1 == ";";
  };
  cout << output1;

Last edited on Nov 24, 2018 at 1:07am
Nov 24, 2018 at 1:07am
Probably because it doesn't compile.
Nov 24, 2018 at 1:07am
it is just a snippet of my code, my actual code is waaay to long to actually put in here. It does also compile but still has this issue
Last edited on Nov 24, 2018 at 1:08am
Nov 24, 2018 at 1:15am
Well, then maybe input1 is different than "11101000".
Nov 24, 2018 at 1:17am
Lines 1, 2 and 3 don't have semi-colons, but since you said the code compiles I'm guessing you just forgot.

Line 5 doesn't do anything. You used the comparison operator, '==', when you want the assignment operator '='.
Nov 24, 2018 at 1:21am
it worked thanks. btw the missung semi-colens are because the part i did not copy from my code and just typed it in there just to... idk why i put those there.
Nov 24, 2018 at 1:27am
the bug came from my pain of trying to use chars instead of strings
Topic archived. No new replies allowed.