please note: this has been asked before
so I am trying speed to learn c++, since my clan have ddecided to start writing a game, but I have only done delphi, C#, java
Problem:
I have read through a few posts regarding this issue and as I understand I need to "overload the cout class" for use of the operator "<<" and ">>",
what is the reason for this, and isnt there a easier method for achieving this
the 2 operators (prob x) are giving the issue
// Custom.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
double input, out;
string degtype;
cin /*>> "What is the temperature: "*/ >> input;
cin /*>> "Convert to [C]elsius or [F]ahrenheit?: " */ [(prob1)>>] degtype;
if (degtype.compare("C") == 0 || degtype.compare("c") == 0)
{
out = (-32 - (input * 1.8)) + input;
degtype = "Celcius";
}
else
if (degtype.compare("F") == 0 || degtype.compare("f") == 0)
{
out = 32 + (input * 1.8);
degtype = "Fahrenheit";
}
cout << "The " [(prob 2)<<] degtype << "value is " << out;
}