Can someone fix this so it can run with codeblocks because m
Can someone fix this so it can run with codeblocks because my first line keep saying no directory and I can\'t fix this to save my life. Please type your code in a way it can be copied and pasted to codebloccks
#include \"passHead.h\"
namespace {
string username;
bool isValid() {
if (username.length() != 8)
return false;
for (size_t i = 0; i < username.length(); i++) {
if (!isalpha(username.at(i))) {
return false;
}
}
return true;
}
}
namespace Authenticate
{
void inputUserName()
{
do
{
cout << \"Enter your username (8 letters only)\" << endl;
cin >> username;
} while (!isValid());
}
string getUserName()
{
return username;
}
}
Password.cpp
#include \"passHead.h\"
namespace {
string password;
bool isValid() {
int count_nonletter=0;
if (password.length() < 8)
return false;
for (size_t i = 0; i < password.length(); i++) {
if (!isalpha(password.at(i))) {
count_nonletter++;
}
}
if(count_nonletter>=1)
return true;
else
return false;
}
}
namespace Authenticate
{
void inputPassword()
{
do
{
cout << \"Enter your password (at least 8 characters \" <<
\"and at least one non-letter)\" << endl;
cin >> password;
} while (!isValid());
}
string getPassword()
{
return password;
}
}
Check.cpp
#include \"passHead.h\"
using namespace Authenticate;
int main()
{
inputUserName();
inputPassword();
cout << \"Your username is \" << getUserName() <<
\" and your password is: \" <<
getPassword() << endl;
system(\"pause\");
return 0;
}
passHead.h
#pragma once
#pragma once
#ifndef USER_PASSWORD_H
#define USER_PASSWORD_H
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
namespace Authenticate
{ // variable and function declarations
void inputUserName();
string getUserName();
void inputPassword();
string getPassword();
}
#endif
Solution
no directory means first check whether you have passHead.h header file in your library i think it is a user defined header file so before you include it in your program make sure that passHead.h is in your header file library.



