Software > Computer programming
Quick Course C++
Raptor:
I am doing a quick course on C++ and the book told me to build a program.
However, each time I do so it generates this error:
--- Quote ---d:\c++ weekend crash course\work\conversion.cpp(13) : error C2676: binary '>' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
Error executing cl.exe.
--- End quote ---
The book is from 2000 and is called C++ Weekend Crash Course
I am using Microsoft Visual 6.0 C++ Standard Edition
What could that error possibly mean?
I have looked on the Internet, but what I found made no sense to me.
A friend of mine is doing the exact same with the same version of Visal C++ and runs into the same error...
Raptor:
Here is the program I am told to recreate..
--- Code: ---//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <stdio.h>
#include <iostream.h>
int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int nCelsius;
cout << “Enter the temperature in Celsius:”;
cin > nCelsius;
// calculate conversion factor for Celsius
// to Fahrenheit
int nFactor;
nFactor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit values
int nFahrenheit;
nFahrenheit = nFactor * nCelsius/100 + 32;
// output the results
cout << “Fahrenheit value is:”;
cout << nFahrenheit;
return 0;
}
--- End code ---
Copied from a .PDF document into a forum.. The layout's a bit.... messy now.
Raptor:
--- Code: --- cin > nCelsius;
--- End code ---
Had to be
--- Code: --- cin >> nCelsius;
--- End code ---
I wonder if they ever bother to double check important things on spelling errors.. No wonder wars are started.
Joleen:
As you've already found out.. a missing "" or ; can completely blow apart your app. Syntax is everything and spelling is huge. Happy learning.
Raptor:
I am aware of that - however, this was not my fault:
cin > instead of cin >>
(The writer's Texan, and we all know what comes from Texas..)
Navigation
[0] Message Index
[#] Next page
Go to full version