-
November 15th, 2003, 09:59 PM
#1
Senior Member
C help
In C i am required to code a program in which i have input the password and check the password, when typping the password the charactes should not get printted on the screen and the cursor should move ahead after every character is typed.
I wonder if someone can help me out.
Thanx a lot.
-
November 15th, 2003, 10:22 PM
#2
If you are required to do it that means that you should be able to do it yourself. I don't really know c or I would help you, but Try doing a few searches on google until someone who actually knows c answers your question. Hope you get your answer.
-
November 15th, 2003, 10:46 PM
#3
Senior Member
Do you have the design written but just dont know a few certain details or do you not know how to do any of it?
-
November 15th, 2003, 10:54 PM
#4
damn h3r3tic, seems like you get more and more APs everyday
i think that this question should have been in the code review section of AO...
well i know how to do it in C++, i typed it up real fast...
Code:
#include <windows.h>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
char password[11];
int main (void)
{
for (int x=0;x<11;x++)//take in your lame password
{
cout << "Please enter your 11 character password..." << endl;
cin >> password[x];
clrscr();//clears the screen
}
cout << "Your password is:" << endl;
for (int x=0;x<11;x++)//now it will tell you your lame password
{
cout << password[x];
}
}
It is pretty simple actually, just take characters in, clear the screen, then at the end, print all the characters out...this was a really shitty way of doing it, but it worked...quick and dirty baby
Support your right to arm bears.
^^This was the first video game which i played on an old win3.1 box
-
November 16th, 2003, 08:02 AM
#5
Code:
#include<stdio.h>
#include<string.h>
void main(void)
{
char ch,passwd[50];
char *cmp_passwd="nulldevice";
int i=0;
printf("\nPassword:");
while((ch=getch())!='\r')
{
if(i==49)
{
printf("passwd too long");
exit(0);
}
passwd[i++]=ch;
printf("*");
}
passwd[i]='\0';
if(strcmp(passwd,cmp_passwd)==0)
printf("\nPasswds Match");
else
printf("\npasswds do not match");
return 0;
}
works fine for me amy prob with me u can contact me.
Originally posted here by White_Eskimo
damn h3r3tic, seems like you get more and more APs everyday
i think that this question should have been in the code review section of AO...
well i know how to do it in C++, i typed it up real fast...
Code:
#include <windows.h>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
char password[11];
int main (void)
{
for (int x=0;x<11;x++)//take in your lame password
{
cout << "Please enter your 11 character password..." << endl;
cin >> password[x];
clrscr();//clears the screen
}
cout << "Your password is:" << endl;
for (int x=0;x<11;x++)//now it will tell you your lame password
{
cout << password[x];
}
}
It is pretty simple actually, just take characters in, clear the screen, then at the end, print all the characters out...this was a really shitty way of doing it, but it worked...quick and dirty baby
the guy says :
and the cursor should move ahead after every character is typed.
clrscr() wont achieve this.
guru@linux:~> who I grep -i blonde I talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; mount; fsck; more; yes; gasp; umount; make clean; sleep;
-
November 16th, 2003, 07:48 PM
#6
i forgot one thing harbir u need to manage backspace (if ur presses this to delete the passwd char) urself.
guru@linux:~> who I grep -i blonde I talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; mount; fsck; more; yes; gasp; umount; make clean; sleep;
-
November 16th, 2003, 07:55 PM
#7
Good god, let the boy/girl do their own homework.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|