19
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << "Hello World!";
}

This isn't working. Why?

Ivan
  • 1,801
  • 2
  • 23
  • 40
  • 1
    The next time you ask questions, you should try to be a bit more concrete, i.e. compiler errors etc. – Alexander Gessler Mar 17 '11 at 17:49
  • 4
    "This isn't working" provides almost no information. Compiler error? Run-time crash? No output? We have no idea. Whenever you are tempted to say "This isn't working", instead please post the thing that happens instead of what you expect. – dfan Mar 17 '11 at 17:49

2 Answers2

58

Because you forgot to #include <string>

Alexander Gessler
  • 45,603
  • 7
  • 82
  • 122
9

You should #include <string>

Tamer Shlash
  • 9,314
  • 5
  • 44
  • 82