Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , , ,

Sponsored Links



Password checker program - help?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-03-2010
Member
 
Join Date: Mar 2010
Location: Tennessee
Posts: 1
Password checker program - help?

Okay...I've been trying to write a piece of code to read a password from the keyboard, check it against a static password (or set thereof; I've found that if I put more than one password in the text file that I'm using currently, the "correct" password cycles depending on what try the user is on). I've gotten far enough to have the code work, but with more than one logic error, and I am confuzzled as to how I go about getting around that. The logic errors plaguing this piece of code are simple: if the password is entered incorrectly multiple times, then when it is finally entered correctly the API is completely ignored, as though I never put it in. I believe the way that I originally referenced the strings to be partially responsible for this, as I originally had it checking whole words against one another instead of what I believe to be the added redundancy of having the checker loop compare individual characters.

My problem is that I am as of yet unsure of whether my strings (pass and passcheck) will accept being indexed as if they were arrays, which is essential to the correct operation of my program.

This originally started off as a homework assignment, but has grown into something of a side project of mine. Any assistance you can provide would be most appreciated (any day I can stave off a headache is a good day indeed).

Code:
#include <conio.h>
#include <fstream.h>
#include <string>
#include <c:\\bc5\\include\\win32\\windows.h>
#include <ctype.h>

void func(char* (&array)[11])		/*passes array by reference; I had an idea from searching around, and was going to try to modify this function to do my bidding*/
{
for (int i = 0; i < 11; ++i)
	{
	cout << array[i] << '\n';
	
	}
}


/*void main()*/
int main()
{
	fstream password("passwd.txt",ios::in);
	string pass,passcheck;
	cout<<"Enter your password: ";
	cin<<pass;
	/*do*/
	/*while(!password.eof)*/
	while(password>>passcheck)
	{
		password>>passcheck;   
		/*if(pass==passcheck)    Old method of checking the password; it checked the values of whole words against one another rather than individual letters
		{
			MessageBox(0,"Accepted", "Ok", MB_OK|MB_EXCLAMATION|MB_TOPMOST);  This is to happen if the password is accepted
		
		else  This is to happen if it doesn't
		{  
			MessageBox(0,"Access Denied", "Ok",   MB_OK|MB_EXCLAMATION|MB_TOPMOST);
		}*/

		for(i=0;i<11;i++) /*This is my current idea on how to make this program work correctly*/
		{
			if(pass[i]==passcheck[1])   /*This loop is supposed to check the value assigned to pass[i] against the value assigned to passcheck[i], and if they are equal then continue*/
			{
				MessageBox(0,"Accepted","Ok",MB_OK|MB_EXCLAMATION|MB_TOPMOST);
			}
	}
/*while(!password.eof)*/  /*I never really could get that particular piece of syntax to work correctly, so I gave up and wrote the above while loop*/
	return 0;
}
Reply With Quote
  #2  
Old 08-05-2010
Reegan's Avatar
Member
 
Join Date: Oct 2005
Posts: 2,299
Password checker program - help?

I have something interesting program in C++ and that is only for you and I hope you can understand and implement it much better than other. It is written in the file(notepad ) attach with the post in the attachment section, just download it and try to implement and if you are getting any problem then please please post me what's your problem ..
Attached Files
File Type: txt password_checking_program_C++.txt (2.8 KB, 1 views)
Reply With Quote
  #3  
Old 08-05-2010
smith001
 
Posts: n/a
Re: Password checker program - help?

As I have seen your comments above & I think my problem is that I am as of yet unsure of whether my strings (pass and passcheck) will accept being indexed as if they were arrays, which is essential to the correct operation of my program.
Thanks
Jessica
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Password checker program - help?"
Thread Thread Starter Forum Replies Last Post
How to allow standard user to run program with admin rights without prompting for password Calebh Operating Systems 7 23-12-2011 12:46 AM
Allow a program to run in Standard account without entering Admin password re4m Networking & Security 1 11-10-2011 02:41 PM
Microsoft Password Checker monsitj Networking & Security 2 07-02-2009 08:54 AM
Stop asking administrator password on start of program? knallan Vista Help 2 11-09-2008 08:30 PM
Program To Get Password Of A Rar File? mauricio Windows Software 3 17-10-2006 09:45 PM


All times are GMT +5.5. The time now is 11:54 AM.