Program always returns binary '>>' : no operator found which takes a left-hand operand of type error

Posted by Tom Ward on Stack Overflow See other posts from Stack Overflow or by Tom Ward
Published on 2012-10-18T15:30:03Z Indexed on 2012/10/18 17:01 UTC
Read the original article Hit count: 153

Filed under:

So I've been set a task to create a temperature converter in C++ using this equation: Celsius = (5/9)*(Fahrenheit – 32)

and so far I've come up with this (I've cut out the 10 lines worth of comments from the start so the code posted begins on line 11, if that makes any sense)

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

int main ()
{ 
float celsius;
float farenheit;

std::cout << "**************************" << endl;
std::cout << "*4001COMP-Lab5-Question 1*" << endl;
std::cout << "**************************" << endl << endl;
std::cout << "Please enter a temperature in farenheit: "; 
std::cin >> farenheit >> endl;
std::cout << "Temperature (farenheit): " << endl;
std::cout << "Temperature (celsius): " << celsius << endl;
std::cin.get();
return 0;
}

Everytime I try to run this program I get a heap of errors with this one appearing every time:

1>m:\visual studio 2010\projects\week 5\week 5\main.cpp(26): error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::basic_istream<_Elem,_Traits>' (or there is no acceptable conversion)

I've tried everything I can think of to get rid of this error but it reappears every time, any idea on how to fix this?

© Stack Overflow or respective owner

Related posts about c++