#Getting the incorrect output when using the << operator
1 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
zedlength = zed.length();
for(int i = 0; i <= zedLength; i++){
if(zed[i] == '1')
zed |= 1 << i;
}
std:: cout << zed; // Prints 27757```
What is seed?
Shoiuld be zed
There are other weird things, but the problem is probably that i goes to zed.length() and zed[zed.length()] is invalid.
zed.length() is just the length of the string
Yes
Which is an invalid index.
Or maybe not if it's a C string.
It's so difficult to tell without seeing any code.
It would be great if you can show the problem on coliru or godbolt or something.
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.