mercredi 22 avril 2015

My template code in C++ is generating odd errors I can't seem to resolve.

I am having some errors appear in my code and i can't figure them out. I reduced my code down to the very basic simple functions/class calls but still have issues with this.

#include <iostream>
using namespace std;

template <class T> 

class FC
    double netprofit, costofinvest;
    double curras, invent, curliab;

    void ROI(double np, double ci)
     netprofit = np; costofinvest = ci;

    double getROI()
     return (netprofit - costofinvest) / costofinvest;

    void ATR(double ca, double inv, double cl)
     curras = ca; invent = inv; curliab = cl;

    double getATR()
    return (curras - invent) / curliab;


int main()
 FC ROI, AcidTestRatio; 

 ROI.ROI(27, 288);
 cout << ROI.getROI() << endl;

 AcidTestRatio.ATR(77, 2l, 344);
 cout << AcidTestRatio.getATR() << endl;

return 0;

The errors I get look like this:

In function 'int main()':
39:22: error: missing template arguments before 'ROI'
41:2: error: 'ROI' was not declared in this scope
44:2: error: 'AcidTestRatio' was not declared in this scope

Aucun commentaire:

Enregistrer un commentaire