c++实验3.txt
来自「数据结构课堂实验 集中了数据结构,线性表,连表,栈,队列,二叉树,图,排序算法」· 文本 代码 · 共 32 行
TXT
32 行
#include <iostream.h>
#include <string.h>
class Password
{public:
Password()
{char stmp[]="PhiL_Cheng";
strcpy(str,stmp);}
int operator == (Password &str2);
void InputStr()
{cin>>str;}
private:
char str[256];
};
int Password::operator==(Password &s)
{if (!strcmp(str,s.str) ) return 1;
else return 0;
}
void main()
{Password p1,p2;
cout<<"Please Input Password:"<<endl;
p2.InputStr();
if (p1==p2) cout<<"You have got the right PassWord!"<<endl;
else cout<<"Your PassWord is wrong, -_-!"<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?