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

Recommended Answers

All 7 Replies

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.

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

sir it didnt run on turbo c++

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.

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.