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

std::istream >> std::string wrong???
Posted by Mesh 1 Jul 2008 16:49
066f948f-707f-45a3-98be-2d66cabdf143
066f948f-707f-45a3-98be-2d66cabdf143(15): error: no operator ">>" matches these operands
            operand types are: std::istream >> std::string
          cin >> number;
              ^

066f948f-707f-45a3-98be-2d66cabdf143(43): error: no operator "<<" matches these operands
            operand types are: std::ostream << std::string
              cout << number << endl;
                   ^

compilation aborted for 066f948f-707f-45a3-98be-2d66cabdf143 (code 2)

When I try to compile, I get this. But I checked my solution to problem 1002, and there I used cin >> string, without any problem.
Re: std::istream >> std::string wrong???
Posted by Rumter (2) 1 Jul 2008 16:58
#include <iostream>
#include <sstream>
using namespace std;
...
string s;
cin >> s;
...
cout << s;
...
Re: std::istream >> std::string wrong???
Posted by Mesh 1 Jul 2008 19:13
Yeah thx, now it works ;)