Results 1 to 7 of 7

Thread: C help

  1. #1
    Senior Member
    Join Date
    Dec 2001
    Posts
    134

    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.

  2. #2
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    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.

  3. #3
    Senior Member
    Join Date
    Jan 2003
    Posts
    120
    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?
    http://www.AntiOnline.com/sig.php?imageid=517

    the Open Source model doesn\'t offer any great benefit in
    terms of reliability and security. -Bill Gates

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    344
    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

  5. #5
    Senior Member
    Join Date
    May 2003
    Posts
    472
    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;

  6. #6
    Senior Member
    Join Date
    May 2003
    Posts
    472
    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;

  7. #7
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    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
  •