Не срабатывает #define
Добавлено: 09 ноя 2010, 12:00
Почему не срабатывает #define и как исправить ?
Tennis.h
Код: Выделить всё
#include "stdafx.h"
#include "conio.h"
#include "Tennis.h"
#define LIM 20;
using namespace std;
int main(){
TableTennisPlayer player1("Chuck","Blizzard",true);
TableTennisPlayer player2("Tara", "Boomdea", false);
player1.Name();
if (player1.HasTable())
cout << ": has a table.\n";
else
cout << ":hasn't a table.\n";
player2.Name();
if (player2.HasTable())
cout << ": has a table";
else
cout << ":hasn't a table.\n";
return 0;
}
Код: Выделить всё
#include "stdafx.h"
#include "conio.h"
using namespace std;
class TableTennisPlayer{
private:
char firstname[LIM];
char lastname[LIM];
bool hasTable;
public:
TableTennisPlayer(const char* fn, const char* ln, bool ht){
strncpy(firstname, fn, LIM-1);
firstname[LIM-1]='\0';
strncpy(lastname, ln, LIM-1);
lastname[LIM-1]='\0';
hasTable=ht;
}
void Name() const{
cout << lastname << ", " << firstname;
}
bool HasTable() const{
return hasTable;
}
void ResetTable(bool v){
hasTable=v;
}
};