对不起,如果我听起来像一个白痴或我的代码本身是坏的,但我需要所有的帮助,我可以得到。很多人编写了这些代码,但我不想看他们的代码,基本上是复制和粘贴。所以这里的问题是,当我尝试运行这个程序时,它给了我那个标识符_TCHAR是未定义的,并且在第20行给出了“< signed/unsigned mismatch”的警告。再次,我很乐意获得任何帮助。C++帮助,密码验证程序
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
const int size = 1000;
char password[size];
int count;
int times1 = 0;
int times2 = 0;
int times3 = 0;
cout << "Please enter your password: ";
cin.getline(password, size);
if (strlen(password) < 6){
cout << "Not valid, your password should be atleast 6 letters";
}
for (count = 0; count < strlen(password); count++)
{
if (isupper(password[count])) {
times1++;
}
if (islower(password[count])){
times2++;
}
if (isdigit(password[count])){
times3++;
}
}
if (times1 == 0) {
cout << "Invalid, the password should contain atleast one uppercase letter";
}
if (times2 == 0) {
cout << "Invalid, the password should contain atleast one lowercase letter";
}
if (times3 == 0) {
cout << "Invalid, the password should contain atleast one digit";
}
cin.get();
return 0;
}
谢谢@drescherjm用于固定后 – Edwin
'_TCHAR'是微软的发明。它不是一个标准的C++类型。 – PaulMcKenzie
'_TCHAR'应该在'windows.h'中。尝试包括该文件。 – Martin