How to create user and pass with number??

Oct 10, 2012 at 12:10pm
hi please help me make a username with number .. im using stdio conio ctype and string as include thanks in advance
Oct 10, 2012 at 12:55pm
Can you give example of username with number? Also, post the code that you have so far (encase in code tag)
Oct 10, 2012 at 1:17pm
username like nhez123 like that
i cant remember it the code but i think it goes like this

#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>

void main () {
int t=1;
character uname[15],pwd[20];
again:
clrscr();
printf("Username:");
scanf("%s",&uname);
printf("password");
scanf("%s",&pwd);
int u = strcmp(uname"nhez");
int p = strcmp(pwd"cute");
if( (u == 0) && (p == 0) ) {
printf("Wellcome");
goto end;}
else{
printf("try again");
goto again;}
else{
t++1
if(t==6);{
printf("you are not allowed to access this page");
printf("press any key to continue...");
goto end;
getch();
end;}
getch();}


something like this but im not sure its just in my mind because my prof give us an assignment to make username and pass with character and number combi

when i run that program when i type the correct user and pass it goes normal but when i change the pass and put number and try to run again and fill with what i change it doesnt accept username
Oct 10, 2012 at 1:34pm
The code doesn't look like C/C++ code, only similar.

By "make username" you mean to accept username which has numbers or generate various usernames with numbers in them (from the code above it looks like you want to accept, just want to confirm)?

If you want to accept this in C++ then

1
2
3
4
string userName;

cout << "Enter username" << endl;
cin >> userName; //This should accept any string, like nhez123 


If you need the basics of C++ programming then http://www.cplusplus.com/doc/tutorial/ is good point to start.
Also, avoid using "goto" its bad style.
Oct 10, 2012 at 1:40pm
its my prof style xD hes a gangnam thanks anyway
Topic archived. No new replies allowed.