So i have a function which gets a string from a function which accepts user input
username as std::string.
password: only as int (restricts user input to to int only)
so i expect only numbers for password.
How i do i check for "|" and when found, compares the input to the one the user entered. If its not correct it jumps to the next line and does the same. else if it correct it jumps the "|" and compares the next 4 numbers and if the are correct it allows the user.
Would be alot of help, since its a project for college :)
You can pass an "offset" to it so that is starts its searching later on in the string. Once you find the first one, remember where it was and use that as an offset to that it'll start searching the next time after the first '|'.
Of course, string::find would work equally well here, but I figure you'll probably be interested in the added capabilities of regex here at some point.