正在尝试创建密码登录
Trying to create a password logon
简而言之,我不确定以前是否有人问过这个问题,但我所做的研究一无所获。我目前正在自学c++,并认为创建某种用户名和密码登录会很好(由于代码问题,我只有密码的结构),使其成为在AWS服务器上运行的ssh into-able程序。根据我所做的研究,我似乎应该做这样的
#include <string>
#include <string.h>
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
string input;
cout << "Enter PW" << endl;
cin >> input;
cout << input << "was what you set" << endl;
}
显然,最终它不会回显密码,我相信这不是最安全的处理方式。每次我试图在Microsoft Visual Studio IDE中编译和运行代码时,都会出现两个错误,这两个错误将我带到
cin >> input;
和
cout << input << "was what you set" << endl;
Error: C2679 binary '>>': no operator found which takes a right-hand
operand of type 'std::string' (or there is no acceptable conversion)
Error C2679 binary '<<': no operator found which takes a right-hand
operand of type 'std::string' (or there is no acceptable conversion)
https://i.stack.imgur.com/qcpXJ.png这是IDE中的控制台应用程序,上面的照片应该包含所有的代码和错误。如果有任何帮助,我们将不胜感激,因为我可以告诉您,只有当我使用字符串变量时,问题才会出现。如果我做的事情完全错了,可以自由告诉我。
干杯!
您在iostream和conio.h 中错过了.h
#include <string.h>
#include "pch.h"
#include <iostream.h>
#include <conio.h>
using namespace std;
int main()
{
string input;
cout << "Enter PW" << endl;
cin >> input;
cout << input << "was what you set" << endl;
}
相关文章:
- c++中的oop(密码生成)
- 密码登录程序将永远循环并显示不正确的结果
- OpenSSL没有共享密码
- Cryptopp:获取密码输入的填充字符串
- 如何检查cURL是否成功登录?c ++
- 密码长度验证 (c++)
- C++ win32 如何使密码字段可选并启用复制和粘贴?
- 仿射密码解密,输出大小写不同
- 替换密码:哪一个?
- 无法使用 openssl 服务器,因为密码已过时...什么的...ERR_SSL_VERSION_OR_CIPHER_MISMATCH
- 如何在 c++ 中将密码和用户名保存到 .txt 文件中.如果用户尝试登录,我仍然希望能够检索它们
- QT MySql 数据库检查登录名和密码以登录
- 如何以编程方式检测登录过程(人脸登录、指纹、密码等)
- 正在尝试创建密码登录
- 在c++登录程序中屏蔽密码
- 如何在c++中的登录/密码窗口中使用回车键
- 如何以编程方式更改 RDP 登录名/密码
- 由于密码丢失,QuickFix登录失败
- 以编程方式加密ODBC DSN登录密码
- 如何将web应用程序的登录和密码数据传递给桌面应用程序而不产生任何安全风险