In short i'm not sure if this question has been asked before but the research I did turned up nothing. I am currently teaching myself c++ and thought it would be neat to create some sort of username and password login (I only have structure for the password due to the code issue) to what will become an ssh into-able program running on a AWS server. Based on research I've done it seems that I should be doing something like this
#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;
}
Obviously in the end it will not echo back a password and i'm sure this isn't the most secure way to handle things. Every time I try to compile and run the code in Microsoft Visual Studio IDE it gives me two errors which take me to the
cin >> input;
and the
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 This is a console application in IDE the photo above should contain all the code and errors as well. Any help would be greatly appreciated, from what I can tell the issue only appears when I use the string variable. If i'm doing things completely wrong fell free to tell me.
Cheers!