Hello i got 3 headers file and getting errors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <string>
#include "Faktura.h"
using namespace std;
int main()
{
Faktura* fakt = new Faktura(1, "Jakub Badura", "Klimkova 1607/4", 10);
PolozkaFaktury* poloz = new PolozkaFaktury("wood ", 450.99);
fakt->addPolozka(poloz);
poloz = new PolozkaFaktury("steal", 500.45);
fakt->addPolozka(poloz);
poloz = new PolozkaFaktury("glass", 1500.99);
fakt->addPolozka(poloz);
poloz = new PolozkaFaktury("car", 1500.87);
fakt->addPolozka(poloz);
poloz = new PolozkaFaktury("steal", 4890.15);
fakt->addPolozka(poloz);
cout << "Pred" << endl;
fakt->printPolozka();
cout << "Celkova cena Faktury: " << fakt->sumPrice() << endl;
cout << endl;
fakt->removePolozka(3);
cout << "Po" << endl;
fakt->printPolozka();
cout << "Celkova cena Faktury: " << fakt->sumPrice() << endl;
system("PAUSE");
return 0;
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#pragma once
#include <string>
#include <iostream>
#include "Person.h"
#include "PolozkaFaktury.h"
using namespace std;
using std::string;
class Faktura
{
private:
int ID;
int pocet;
Person* osoba;
PolozkaFaktury** pole;
public:
Faktura(int ID, string jmeno, string adresa, int n);
~Faktura();
void addPolozka(PolozkaFaktury* polozka);
bool removePolozka(int n);
double sumPrice();
void printPolozka();
int getPocet();
void increasePocet();
void decreasePocet();
};
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#pragma once
#include "Faktura.h"
#include <string>
using std::string;
class Person
{
private:
string jmeno;
string adresa;
public:
Person(string jmeno, string adresa);
string getName(string jmeno);
string getAddress(string adresa);
};
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#pragma once
#include "Faktura.h"
#include <string>
using std::string;
class PolozkaFaktury
{
private:
string nazev;
double cena;
public:
PolozkaFaktury(string nazev, double cena);
string getNazev();
double getPrice();
};
|
When the heades is in one file its working, but when a put them seperatly a got this :
Severity Code Description Project File Line Suppression State
Error C2238 unexpected token(s) preceding ';' Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 17
Error C2143 syntax error: missing ';' before '*' Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 18
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 18
Error C2238 unexpected token(s) preceding ';' Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 18
Error C2061 syntax error: identifier 'PolozkaFaktury' Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 23
Error C2143 syntax error: missing ';' before '*' Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 17
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Project2Faktura c:\users\pc\source\repos\project2faktura\project2faktura\faktura.h 17
SRY for bad English.