-1

I am currently trying to learn the basics of C++. I am using visual studios and have found a strange problem:

#include "stdafx.h"
#include <iostream>

using namespace std;


int main()
{
    string name = "Example name";
    cout << "Hello " << name << endl;

    int pause;
    cin >> pause;
    return 0;
}

I cant use the "<<" twice when trying to output my string. It showes the red lines under the second << and wont let me compile. Any answers? Should I just use another IDE?

Morgan Adamsson
  • 21
  • 1
  • 1
  • 4

1 Answers1

4

you forgot to #include <string> where operator<< is defined for std::string

Starl1ght
  • 4,422
  • 1
  • 21
  • 49