i've done a program. Unfortunately when trying to build it i got an error in function: undefined reference to `RzymArabException::RzymArabException(std::string). When i was throwing a simple class like class Rzym{}; there was no errors. But when i created a class with some kind data(constructors and messages inside it doesnt work) I would be grateful if u could point where the mistake is.
#include <iostream>
#include <string>
using namespace std;
class RzymArabException{ //wyjatki
private:
string message;
int pozazakres;
public:
RzymArabException(string message);
RzymArabException(int pozazakres);
string getMessage(){return message;};
};
class RzymArab {
private:
static string rzym[13]; //konwersja z arabskich na rzymskie
static int arab[13];
static char rzymskie[7];
static int arabskie[7]; //konwersja z rzymskich na arabskie
public:
static int rzym2arab(string);
static string arab2rzym(int);
};
string RzymArab::rzym[13] = {"I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"};
int RzymArab::arab[13] = {1,4,5,9,10,40,50,90,100,400,500,900,1000};
int RzymArab::arabskie[7] = {1000,500,100,50,10,5,1};
char RzymArab::rzymskie[7] = {'M','D','C','L','X','V','I'};
string RzymArab::arab2rzym(int x){
string s="";
if(x<1 || x>3999)
throw RzymArabException("Podana liczba w zapisie arabskim nie nalezy do dozwolonego przedzialu:(1..3999)");
else{
int i=12;
while(x>=1){
if(x>=arab[i]){
x-=arab[i];
s=s+rzym[i];
}
else
i-=1;
}
}
return s;
}