/**
Stephen Ingram
CS 115 Sec 401
D. Cichon
10/25/2008
s.ingram@uky.edu
This program decides whether a .txt file passes a certain test based on its contents.
**/
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
void invalid_Password(int pass_Length);
usingnamespace std;
int main()
{
string file;
string password;
string name;
int num1;
int num2;
ifstream InFile;
ofstream OutFile;
cout << "Secure Password Checker." << endl;
cout << "Please enter the name of the file you want checked --> ";
cin >> file;
//Open the file
InFile.open(file.c_str());
if(InFile.is_open() == false)
{
cout << "Sorry, there must be a mistake, there is no such file!" << endl;
return 1;
}
//reading file for strings and such to start out the test
getline(InFile, name);
getline(InFile, password);
InFile >> num1;
InFile >> num2;
//close file
InFile.close();
int pass_Length = password.length();
invalid_password(int pass_Length);
return 0;
}
void invalid_Password(int pass_Length)
{
if(password.length() < 6)
{
cout << "The file myfile.txt is invalid." << endl;
}
}
It's telling me that password in password.length() has not been identified. What's wrong with it?
You have made an error in Line 60 - in the invalid_Password function.
This functions has no local string variable called password, so your
statement if(password.length() < 6) is incorrect.