
wyjatki.h
By: a guest on
Apr 29th, 2012 | syntax:
C++ | size: 1.03 KB | hits: 56 | expires: Never
#pragma once
#include <iostream>
#include "reader.h"
using namespace std;
struct xcp_wrong_type
{
char* was;
char* should_be;
xcp_wrong_type(const char* m1, const char* m2)
{
was = new char[strlen(m1)+1];
strcpy(was,m1);
should_be = new char[strlen(m2)+1];
strcpy(should_be,m2);
}
xcp_wrong_type(const xcp_wrong_type& t)
{
was = new char[strlen(t.was)+1];
strcpy(was, t.was);
should_be = new char[strlen(t.should_be)+1];
strcpy(should_be, t.should_be);
}
~xcp_wrong_type()
{
delete [] was;
delete [] should_be;
}
void opis()
{
cout << "Podales: " << was << ", a powinno byc typu: " << should_be << endl;
}
};
struct xcp_value
{
void opis()
{
cout << "Podana liczba przekracza 40000." << endl;
}
};
struct xcp_division_by_zero
{
char* number;
xcp_division_by_zero(const char* n)
{
number = new char[strlen(n)+1];
strcpy(number,n);
}
void opis()
{
cout << "Nie mozna dzielic liczby " << number << " przez 0." << endl;
}
};