try 10. some systems use 10, some 13.
you might also initialize pass -- it could randomly start at 13 from time to time which would cause weird behavior.
#include <iostream>
//#include <cstring> // <--- Not needed with what you have.
#include <string>
#include <conio.h>
#include <cctype> // <--- May not be needed.
int main()
{
char pass{}; // <--- Always good practice to initialize your variables.
std::string str{};
while (pass != 13)
{
pass = _getch();
std::cout << ".";
str.push_back(pass); // <--- Builds a std::string.
}
std::cout << '\n' << str << std::endl; // <--- Prints the string built in the while loop.
// I use this to keep the console window open, so it does not close to early.
std::cout << "\n\n\n\n Press anykey to continue";
_getch();
return 0;
}
This way you have "str" to use later in the program to compare with a stored password.