I'm getting an unresolved symbols linking error with this code, the cpp files compile successfully separately, I just can't build the solution and run it. any ideas?
header.h
#include <iostream>
#include <string>
using std::string;
using namespace std;
class Double
{
private:
double dub;
char str[50];
public:
Double();
Double(char s[50]);
Double(double a);
void toDouble(char str[50]);
void toString();
void printClass();
void equal(char str[50]);
void equal(double dub);
bool isNAN(char s[50]);
};
double.cpp
#include <math.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <string.h>
#include <conio.h>
#include "header.h"
using namespace std;
Double::Double()
{
}
Double::Double(char s[50])
{
strcpy(str, s);
}
Double::Double(double a)
{
dub=a;
}
void Double::toDouble(char str[50])
{
if(!isNAN(str))
dub = atof(str);
}
void Double::toString()
{
sprintf(str,"%f",dub);
}
void Double::equal(char s[])
{
strcpy(str, s);
}
void Double::equal(double d)
{
dub=d;
}
bool isNAN(char s[])
{
string str=s;
cout<<s<<endl;
cout<<str<<endl;
for(int i=0; i<str.size(); i++)
{
if(!isdigit(s[i]))
return true;
}
return false;
}
void Double::printClass()
{
cout<<dub<<endl;
cout<<str<<endl;
}
main.cpp
#include <iostream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <string.h>
#include <conio.h>
#include "header.h"
using namespace std;
int printMenu();
void waitKey();
const int ADDSTRING=1;
const int ADDDOUBLE=2;
const int EXIT=3;
int main()
{
char s[50]="123.223h";
Double d, str(*s), dubble(123.233);
d.toDouble("123.222h");
}