hey everyone
ok so i have reached another road block any pointers are much appreciated the program will not compile due to eclipse not liking the
int Password::passwordNumber(int i);
int Password::passwordCapLetter(int i);
in the .h
any ideas
demp.cpp
/* File Name: Demo.cpp
Chapter No. 12 - Exercise No. 12
Programmer: Carl Sue
Date Last Modified: Mar 9, 2010
Problem Statement: (what you want the code to do)
Imagine you are developing a software package that requires users to
enter their own passwords. Your software requires that user’s
passwords meet the following criteria:
The password should be at least six characters long.
The password should contain at least one upper-case and at least
one lower-case letter.
The password should have at least one digit.
Write a program that asks for a password and then verifies that
it meets the stated criteria. If it doesn’t, the program should
display a message telling the user why.
Classes needed and Purpose (Input, Processing, Output):
*/
#include <iostream>
#include "Password.h"
using namespace std;
int main(int argc, char * const argv[]){
string pass;
cout << "enter a password: ";
cin >> pass;
if (pass.length() < 6) {
cout << "password must be longer than 6 characters. ";
} else {
Password passwd(pass);
passwd.passwordCapLetter(pass.length());
passwd.passwordNumber(pass.length());
}
return 0;
}
password.cpp
/*
* Password.cpp
*
* Created on: Mar 9, 2010
* Author: Carl
*/
#include "Password.h"
Password::Password() {
// TODO Auto-generated constructor stub
}
Password::Password(string s){
password = s;
flag1 = false;
flag2 = false;
}
Password::~Password() {
// TODO Auto-generated destructor stub
}
int Password::passwordNumber(int i){
if (i > 0) {
if (password[i] >= 48 && password[i] <= 57) {
flag3 = true;
}
return passwordNumber(i-1);
} else {
if (flag3 == true) {
cout << "your password needs a capital letter";
}
}
}
int Password::passwordCapLetter(int i){
if (i > 0) {
if (password[i] >= 65 && password[i] <= 90) {
flag1 = true;
}
if (password[i] >= 97 && password[i] <= 122) {
flag2 = true;
}
return passwordCapLetter(i-1);
} else {
if (flag1 == true) {
cout << "your password needs a capital letter";
}
}
}
password.h
/*
* Password.h
*
* Created on: Mar 9, 2010
* Author: Carl
*/
#ifndef PASSWORD_H_
#define PASSWORD_H_
#include <iostream>
using namespace std;
class Password {
public:
Password();
Password(string);
virtual ~Password();
int Password::passwordNumber(int i);
int Password::passwordCapLetter(int i);
private:
static string password;
static bool flag1, flag2, flag3;
};
#endif /* PASSWORD_H_ */
again thanks for any help