Hello ladies and gents,
Ive been reading about how when a class becomes to big due to to many memberfunctions, it is best to split the program up into several sections wich could be something like this:
Interface section
Implemenation section
Application section
I was given an example wich is this one, but in trying this out, I got an error message in the Implementation and Application section wich was this one:
C:\Program Files\Microsoft Visual Studio\MyProjects\LATestVoorbeeldenBoekVervolg2\LATestVoorbeeldenBoekVervolg2.cpp(4) : fatal error C1083: Cannot open include file: 'vkv.h': No such file or directory
Error executing cl.exe.
I know it has to do with the fact that I have to implement the "vkv.h" file into the program, problem is, I don't know how or where I have to put it :-|
The program exists out of these three parts:
class vkv
{
private:
void coeff (double aa, double bb, double cc);
bool losOp();
double wortel1()const {return x1;}
double wortel2()const {return x2;}
private:
double a, b, c, x1, x2;
};
#include <cmath>
#include "vkv.h"
void vkv::coeff(double aa, double bb, double cc)
{
a = aa; b = bb; c = cc;
}
bool vkv::losOp()
{
double D = b * b - 4 * a * c;
if (a == 0 || D < 0)
return false;
double wD = sqrt(D);
x1 = (-b + wD)/(2 * a);
x2 = (-b - wD)/(2 * a);
return true;
}
#include <iostream>
#include "vkv.h"
using namespace std;
int main
{
double a, b, c;
cout<<"Typ a, b en c: ";
cin>> a >> b >> c;
vkv v;
v.coeff(a, b, c);
if (v.losOp())
cout<<"Wortels: "<< v.wortel1() <<" "<< v.wortel2() <<endl;
else
cout<< "Geen reële wortels.\n";
return 0;
}
I understand that the "vkv.h" headerfile is needed to link the two last sections of code so that they know they can use that file. Thing is, don't know where or HOW to put it anywhere :?:
Do I have to put in into the Header Files map of the Workspace of the last two sections, if so, how or what do I write then :?: