hi please help me make a username with number .. im using stdio conio ctype and string as include thanks in advance

5 Years
Discussion Span
Last Post by NathanOliver

What do you mean by having a username made of numbers? Do you want a text username that gets encrypted into numbers?


a username that combines number like nhez12 and password like nhez12 like that


Well you can use the string type. The string type can hold pretty much every character that is on the standard us keyboard.

#include <string>
#include <iostream>

using namespace std;

int main()
    string username, password;
    cout << "Please enter a username: ";
    cin >> username;
    cout << "Please enter a password: ":
    cin >> password;
    cin.ignore(80, '\n');  // clear input buffer

    cout << "Username: " << username << endl;
    cout << "Password: " << password << endl;
    cin.get();  // pause program

    return 0;

If you know hashing, you can create a simple hash function which takes username and some "key", hashes them to give you a unique password for that username. Here is a nice tutorial on hashing.

Edited by np complete


nathan can you put code that it will loop for 5 times? because my prof requirements is
1. max of 15 char
2. only 5 tries loop
3. and 5 login tries
thank you

Edited by nheziscute22: lack of info


The code I posted will run on a standard conforming complier but turbo c++ is not standard. We do not do your homework for you. You come up with the code and we will help you fix it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.