Quelqun peut il corriger ce qui ne vas pas dans ce programme s'il vous plait

gasy72 Messages postés 23 Date d'inscription jeudi 2 mars 2006 Statut Membre Dernière intervention 11 août 2006 - 19 mars 2006 à 15:01
gasy72 Messages postés 23 Date d'inscription jeudi 2 mars 2006 Statut Membre Dernière intervention 11 août 2006 - 20 mars 2006 à 14:33
en fait je commence à programmer en C++ maintenant et j'apprend en modifiant et en essayant de comprendre certain programme.voici par exemple un code source que j'ai et que j'ai essayé de compiler avec Vc++ amis apres compilation il trouve beaucoup d'erreur et j'arrive pas à le modifier ainsi si quelqun peut le faire s'il vous plait je vous en remercie beaucoup.

voici le code:


// Include file for C Alice


#ifndef I_C_ALICE


#define I_C_ALICE


#define NUM_VARS 35
// Number of 'personality' and other vars


#define SHIFTMASK (254 + (254 << 8) + (254 << 16))


#define DSHIFTMASK (252 + (252 << 8) + (252 << 16))


#define TSHIFTMASK (248 + (248 << 8) + (248 << 16))


#define QSHIFTMASK (240 + (240 << 8) + (240 << 16))


#define MASKTEST (128 + (128 << 8) + (128 << 16))


#define SPEAKING


// #define USE_INTERNET


// #define FULLSCREEN


// #define SHOWHEAD


#define RESPONSECOLOR (0x0090FF90)


#define USERINPUTCOLOR (0x0060DF35)


#define SHOWFLOCK


#define PREPROCESSOR


#include
"pixeltoaster.h"


#include
"head.h"


#include
"flock.h"


#define SCREENX 512


#define SCREENY 384


#define PIXEL
unsigned
long


#include
<stdio.h>


#include
<conio.h>


#include
<time.h>


#include


#include
"string.h"


#include
"stdlib.h"


#include
"math.h"


#ifdef USE_INTERNET


#include "fcntl.h"


#include "winsock.h"


#endif


class Typist


{


public:


Typist();


~Typist() {}



void write(
char* line );


private:



char typo[26];


};


class GPrinter


{


public:


GPrinter();


~GPrinter() {}



void setfont(
int n );



void cursor(
bool show );



void woosh(
char* text );



void print(
int layer,
char* text );



void cursive(
bool c ) { cursv = c; }


private:



char* m_char[54][5], *m_chr1[54][7], *m_chr2[54][7];



char*** m_cchar;



int m_transl[256];



int m_font, m_fontw, m_fonth, m_xmax, m_ymax, curlayer, curx, cury;



char* pbuffer;


PIXEL* pixels, color;



bool cursv;


};


class Printer


{


public:


Printer();


~Printer();



void flush(
void );



void clearbuffer(
void ) { pbuffer[0] = 0; }



void print(
char* text );



char* GetPBuffer() {
return pbuffer; }



void PrintUrls(
bool flag ) { printurls = flag; }



bool PrintUrls(
void ) {
return printurls; }



void Speaking(
bool flag ) { speaking = flag; }



bool Speaking(
void ) {
return speaking; }



void HumanTypist(
bool flag ) { humantypist = flag; }



bool HumanTypist(
void ) {
return humantypist; }


private:



char* pbuffer, *buffer;



bool printurls, speaking, humantypist;


Typist typist;


};


#ifdef PREPROCESSOR


class Preprocessor


{


public:


Preprocessor();


~Preprocessor();



void prepare(
bool aiml,
bool dict );


private:



bool checkpattern(
char* patt );



bool checktemplate(
char* temp );



bool checktags(
char* line );



bool checkline(
char* line );



void dictionary(
char* file,
bool final );



void senttotemp(
char* src, FILE* dest );



char** dict;



char* mess;



char** tags;



int tagcount;



int* wcount;


};


#endif


class Alice


{


public:


Alice();


~Alice();



void tidyup(
char* text );



void analyzer(
void );



bool match(
char* text,
char* pattern,
bool final );



void print(
char* line );



void person(
char* text,
char* pstring,
char* pfile );



void reevaluate(
char* line );



int wordcount(
char* text );



void randomize(
char* text );



bool trysecond(
void );



bool spellchecker(
char* text );



void tokenizer(
char* text );



bool condition(
char* text );



void respond(
char* text,
char* bot );



bool checkfiles(
char* bot );



bool checkdict();



void savevars(
char* varfile );



void loadvars(
char* varfile );



void initialize(
void );



void log(
char* text ) { fprintf( logfile, text ); fflush( logfile ); }



void nextevent(
void );



void interupt(
char* text,
bool flash );



int calcmood(
char* text );



void updatemood(
char* text );



void inputloop(
void );



void greeting(
void );



void execute(
char* command );



void setchunk(
int idx, fpos_t& pos ) { chunk[idx] = pos; }



char* username(
void ) {
return var[8]; }



void gatheraiml(
void );



int mainloop(
void );



char* prevstr, *prevbuf;


private:



char* star, *star2, *that, *buffer, *second, *justthat, *beforethat;



char defaultvar[NUM_VARS + 1][128], *var[NUM_VARS + 1], *emess;



char* pluseoln, *texteoln;
// Used in match



char* agenda1, *agenda2;
// Agenda item (to be confirmed)



char* saves[10];



int sage[10];



char setvars[NUM_VARS + 1][40], getvars[NUM_VARS + 1][40];



int pateval, recursion, tokens;



bool newvarfile, exitplease, repetitive, spellcheck, garbage;



float happyness, helpfullness, humor, affection, trust, interest;


time_t lastrun, lastquit, thisrun;


FILE* logfile, *newaiml;


time_t wakeup, secdelay;


Printer printer;


fpos_t chunk[27];



char* user_input, **token, *userstr;



bool topic[5];


};


class Display


{


public:


Display();


~Display();



void update(
void );



void clearinput(
void );



void scrolltext(
int layer );



void loadimage(
char* file );



void blur(
int layer );



void fadeout(
int layer );



void wipeeffect(
int layer );



void flash(
void );



void clearscreen(
int layer );



void thematrix(
unsigned
long* pixels );



void setbar(
int idx,
float val ) { bar[idx] = val; }



unsigned
long* text1ptr(
void ) {
return text1; }



unsigned
long* text2ptr(
void ) {
return text2; }



unsigned
long* backptr(
void ) {
return backgrnd; }



int key(
void ) {
return console.key(); }



bool read(
void ) {
return console.read(); }



int xpos(
int layer ) {
return curx[layer - 1]; }



int ypos(
int layer ) {
return cury[layer - 1]; }



void xpos(
int layer,
int x ) { curx[layer - 1] = x; }



void ypos(
int layer,
int y ) { cury[layer - 1] = y; }



unsigned
long color(
int layer ) {
return col[layer - 1]; }



void color(
int layer,
unsigned
long c ) { col[layer - 1] = c; }



void matrix(
bool m) { meffect = m; }



bool matrix(
void ) {
return meffect; }



void xmax(
int y,
int x ) { llen[y] = x; }


Flock* GetFlock(
void ) {
return flock; }


Head* GetHead(
void ) {
return head; }


private:



unsigned
long* text1, *text2, *backgrnd;



int console;



int *surface;



int curx[4], cury[4];



unsigned
long col[4];



float bar[6];



int columns, *moffs, *mspeed, *aline;



bool meffect;



int llen;



int head;



float flock;



float yrot;


};


#ifdef USE_INTERNET


class Internet


{


public:


Internet() {}


~Internet() {}


void gethttp( LPCSTR server, LPCSTR file );


private:


};


#endif


// stuff


bool fexists(
char* file );


void compress(
char* buffer );


void expand(
char* line );


time_t str2time(
char* text,
bool weekend );


int random(
int max );


int strval(
char* text );


void delay(
int msecs );


void remove(
char* text,
char* first,
char* last );


void bzero(
char* text,
int len );


void uppercase(
char* text );


void lowercase(
char* text );


bool replace(
char* line,
char* string1,
char* string2 );


void cleaner(
char* text );


int count(
char* text,
char* subst );


void substitute(
char* text,
char* file );


int fuzzymatch(
char* pattern,
char* text );


#endif

et voici le liste d'erreur trouveé:


->
c_alice.h(187): error C2228: la partie gauche de '.key' doit avoir un class/struct/union le type est 'int'
->c_alice.h(188) : error C2228: la partie gauche de '.read' doit avoir un class/struct/union le type est 'int'
->c_alice.h(197) : error C2109: un indice requiert un type tableau ou pointeur
->c_alice.h(198) : error C2440: 'return' : impossible de convertir de 'float' en 'Flock *'
->c_alice.h(199) : error C2440: 'return' : impossible de convertir de 'int' en 'Head *'
La conversion d'un type intégral en type pointeur nécessite reinterpret_cast, un cast de style C ou un cast de style fonction


je ne sais donc pas comment faire pour corriger ces erreurs.Je sais qu'y a des types qui correspondent pas et surtout l'utilisation de classe c'est pas vraiment mon fort alors un peu d'aide sera le bienvenu merci d'avance.

crois seulement

2 réponses

DeAtHCrAsH Messages postés 2670 Date d'inscription vendredi 25 janvier 2002 Statut Membre Dernière intervention 6 février 2013
19 mars 2006 à 16:08
Pour commencer, consol.key n'est pas logique etant donné que console est déclaré en tant que int.
Un int est un type primitif, tu ne peux donc rien a voir après!
Idem pour read.

Pour le reste, je ne vois pas trop ce que tu veux faire et ne peut donc t'aider plus.

Shell
0
gasy72 Messages postés 23 Date d'inscription jeudi 2 mars 2006 Statut Membre Dernière intervention 11 août 2006
20 mars 2006 à 14:33
qu'est ce que je dois mettre pour corriger consol.key et read alors?

crois seulement
0
Rejoignez-nous