Reputation: 11
I'm a complete noob at C++, and the first problem I am encountering is the following:
no operator >> matches these operands
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "hello world!";
cin >> "hello world!";
}
Upvotes: 0
Views: 227
Reputation: 11158
std::cin
needs to write to a variable, but you are passing it a const char[13]
string literal instead.
You need to pass it something like a std::string
instead:
std::string str;
std::cin >> str;
P.S. This is a good time to a) read compiler messages, b) avoid using namespace std;
globally, c) get a good C++ book.
Upvotes: 6