ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Very Unclear: С++, string
Posted by Alex_SyktSU 6 Nov 2006 04:37
Quoting from FAQ:

(C++)Чтобы считать строки:

string line;
while (getline(cin, line))
{
   ...
}

Quoting from reply to email after compilation error:

ab3282a0-122f-4786-b6ac-350db0fd59d9(15): error: identifier "string" is undefined
          string te;
          ^

By the way I tried to include string or string.h headers - no matter.

So where is the truth??
Re: Very Unclear: С++, string
Posted by Anton [SUrSU] 6 Nov 2006 14:02
May be you forgot to add "using namespace std"
Re: Very Unclear: С++, string
Posted by Alex_SyktSU 6 Nov 2006 19:22
Ok, tried, got CE, but in addition:
576f34f4-c336-4262-9fca-d2ba8775464b(2): error: name must be a namespace
name
  using namespace std;
                  ^
Re: Very Unclear: С++, string
Posted by Anton [SUrSU] 6 Nov 2006 19:35
Does this code got CE on C++?
#include <string>
using namespace std;
int main()
{
return 0;
}
Re: Very Unclear: С++, string
Posted by Alex_SyktSU 6 Nov 2006 22:21
It seems I found the problem.
 If I write like this:

#include <string>
#include <iostream.h>
using namespace std;
int main()
{
return 0;
}

I get CE.

But if it's like this:

#include <string>
#include <iostream>
using namespace std;
int main()
{
return 0;
}

All works properly.

Thanks for help.