Odd console output.
I'm trying to make my very own bootleg notepad, but I'm running into an issue(not an error, but just an issue).
The code is simple and basic, but I think I'm having compiler issues. For now, the code asks for a password to save all your notes in and then asks for confirmation.
If you choose to save your password the screen clears and asks for the name of your first note.
But when you enter your note name, the console outputs something like "bash: command not found". I wonder what's going on with it; can you help me, please?
std::cin worked for me too; I was just trying to be fancy by using getline! Compilers are weird; methods only work when they want to. lol.
Also, do you think my code is well structured? Thank you for your assistance!
hmmm... maybe you can make a for a loop which converts underscores into spaces if you want to. You can make it so it loops through the whole string:
and make it so that there is an if statement that checks if the character is an underscore, and you can have an incrementing variable starting with 0 too so you can get an index, and if the if statement finds out that the character is an underscore then you can use the index to replace the underscore in the string with a space. I don't know if you understood but for now I will not give you the code cause I want you to try it by yourself
Don't forget about references. (no need for an index)
Just makes things simpler.
Also, you could try doing
std::cin << std::flush; before the second
std::getline(). I've also encountered this error with
std::getline() before, and If I remember correctly that fixed it. It's something to do with
std::getline() swallowing the
\n at the end or something...?
It is a reference to each item in the list, so if I did
as you can see, it's actually modifying the elements in the array. it's the same exact concept as passing by value vs. passing by reference:
for(auto it : arr) gives you just the value, not the element (=passing by value)
for(auto& it : arr) gives you a reference, so the actual element (=passing by reference)
hence, these two pieces of code are identical:
Thank both of you! I should've thought about using references long before I asked this question, but you live to learn!
I used the ASCII chart to solve the problem since printed characters are just abstractions of numbers.
I check to see if the character in question is in the alphabet according to ASCII, If it's not, change it into an
Thank you for providing an alternative interpretation of my code!
Finally, I have understood. To be true I also don't know tho cause I want to learn how to build games but I haven't started yet. I probably will run into the same problem as you... @0068930
Sorry for the ping but @OldWizard209 can you help this dude out? You seem to be very WIZE lol but seriously you do know lots of knowledge in the realm of code