Password retrieval

This is a discussion on Password retrieval within the C++ Programming forums, part of the General Programming Boards category; ok so i was assigned an assignment to make a simmple program in Dev C++. our teacher owuld like us ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    12

    Password retrieval

    ok so i was assigned an assignment to make a simmple program in Dev C++. our teacher owuld like us to create a simple password retrieval program.

    so if you were to enter a number such as 1234 the program would scan until it finds 1234. what i need is how do i get the program to incorparate letters and number so if i were to enter 1w2e3 how would i program the program to do this. this is what i have so far if anyone can help thatd be great.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    int main(int argc, char *argv[])
    {
        int i;
        for(i = 0; i < 99999; i++) {
              printf("Trying password %d\n",i);
                if(52220 == i) {
                        
                     printf("The password is %d\n",i);
                     break;     
                }
        }  
      system("PAUSE");	
      return 0;
    }

  2. #2
    Registered User
    Join Date
    Feb 2011
    Posts
    12
    anyone?!?!?!?!??!?!?!?!??!?!?!??!?!??!?!?!?!?

  3. #3
    -bleh-
    Join Date
    Aug 2010
    Location
    somewhere in this universe
    Posts
    455
    Use char instead if int for the password.
    "All that we see or seem
    Is but a dream within a dream." - Poe

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    2,588
    Hint: research strcmp from string.h

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    12
    sojust char main and inted of %d use %c and change 0 to a and 9999 to b????

  6. #6
    printf("Hello Cboard\n"); codeprada's Avatar
    Join Date
    Jan 2011
    Location
    In a little room at the back of your brain
    Posts
    68
    Quote Originally Posted by jeromey55 View Post
    sojust char main and inted of %d use %c and change 0 to a and 9999 to b????
    what he meant was store the passwords in a string array .
    We shouldn't be quick to criticize unless we can do better.
    Code:
    public function __clone() { die ( "I'm one of a kind" ); }

  7. #7
    Registered User bobknows's Avatar
    Join Date
    Jan 2011
    Location
    SD
    Posts
    87
    you should set a length for the password. there is a way that you can add driectly to the binary but idk how for sure, also, set up the password as a string of chars and use several for\while loops. it makes it a lot easier

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A tenet connection from a C program..
    By ahmd2080 in forum Linux Programming
    Replies: 2
    Last Post: 07-04-2009, 03:42 AM
  2. Problem reading a password from a file.
    By medeshago in forum C Programming
    Replies: 15
    Last Post: 12-21-2008, 06:20 AM
  3. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 02:42 AM
  4. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21