Hi. I am trying to create an object in c++ but I'm doing terrible. I have tried the following code;
#include <iostream>
#include <fstream>
#include <math.h>
int main (int argc, char * const argv[]) {
using namespace std;
tst test; //error! tst was not declared in this scope. & expected ';' before test end comment//
double a=tst.input(9);
cout << a;
return 0;
}
//--------- tst.cpp
class tst{
public:
double input(double d);
};
double tst::input(double d){
return(d+1);
}
What did I miss?
#include <iostream>
#include <fstream>
#include <math.h>
int main (int argc, char * const argv[]) {
using namespace std;
tst test; //error! tst was not declared in this scope. & expected ';' before test end comment//
double a=tst.input(9);
cout << a;
return 0;
}
//--------- tst.cpp
class tst{
public:
double input(double d);
};
double tst::input(double d){
return(d+1);
}
What did I miss?
