Hi!
I created a primitive login system and am wondering if I could somehow not show the actual password and instead asterisk.

Here is the code :

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string username;
	string password;

	cout << "Do you want to register?" << endl;
	cout << "Enter desired username : ";
		cin >> username;
	cout << "Enter your password : ";
		cin >> password;

		string userIn;
		string passIn;
	cout << "\n\nLogin now!" << endl << "Username :";
		cin >> userIn;
	cout << "\nPassword :";
		cin >> passIn;

	if ( userIn != username || passIn != password) 
	{
		cout << "The password or username is incorrect" << endl;
	}else{
		cout << "Welcome " << username << " !" << endl;
	}
	system("pause");
	return 0;
}

The output should be something like this
Password : ********
Thanks in advance!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.