Hi, I've recently started learning C++ using 'C++ Demystified' and I'm trying to make this function work. I've done the pointers chapter and I saw a little function that uses <cctype>, and I'm trying to get it to work. Heres the code:
#include <iostream>
#include <cctype>
using namespace std;
bool isValidPassWord(char*);
int main(void)
{
char* name;
bool test;
cout << "Enter name: ";
cin.getline(name, 3);
test = isValidPassWord(&name);
if (test != true)
cout << "Invalid password entered" << endl;
else
cout << "Your password is " << *name << endl;
return 0;
}
bool isValidPassWord(char* pw)
{
if (!isupper(pw[0]))
return false;
if (!isdigit(pw[1]))
return false;
if (!islower(pw[2]))
return false;
return true;
}
The error I get is error C2664: 'isValidPassWord' : cannot convert parameter 1 from 'char ** ' to 'char *' Types pointed to are unrelated
I have a feeling I'm missing something obvious, but really can't figure it out. Any help is appreciated.
Thanks.