ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

std::istream >> std::string wrong???
Послано Mesh 1 июл 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???
Послано Rumter (2) 1 июл 2008 16:58
#include <iostream>
#include <sstream>
using namespace std;
...
string s;
cin >> s;
...
cout << s;
...
Re: std::istream >> std::string wrong???
Послано Mesh 1 июл 2008 19:13
Yeah thx, now it works ;)