my library is
Code:
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
Do i need the std:: part on ostringstream if i have included both string and cstring, just to be safe?
__________________________________________________ ____________________________________
I #include <sstream>, and i found out i don't need that std:: part. What is the purpose to the std:: part anyways?
Also for some reason my code outputs nothing, it should return the string.
header file
Code:
string Add(double A, double B)
{
double C,D,X;
string Hide;
Hide = "";
if( B > 0)
{
ostringstream o;
C = A;
D = B;
X = C/D;
o << X;
Hide = o.str();
}
else
{
Hide = "Illegal Division By Zero";
}
return Hide;
}
calling program:
Code:
#include "stdafx.h"
#include "Overload.h"
int main()
{
COverload Me;
Me.Add(3,4);
cout << "\n\n";
system("pause");
return 0;
}
it doesn't return the 0.75 if i have 3,4
nor does it return the Hide = "Illegal Division By Zero"; line if i put 0 for B.