PDA

View Full Version : چرا این کد رو نمی تونم توی کامپایلرم اجرا کنم؟



moosavimaleki
پنج شنبه 08 دی 1390, 20:47 عصر
بی نظمی توی c++ داره منو میکشه ! هر کی ورداشته یه تغییری واسه خودش داده!

این کد :
http://barnamenevis.org/showthread.php?111041-%D8%A7%DB%8C%D8%AC%D8%A7%D8%AF-%D9%85%D9%86%D9%88(menu)-%DA%AF%D8%B1%D8%A7%D9%81%DB%8C%DA%A9%DB%8C-%D8%AF%D8%B1-%D8%B3%DB%8C


#include<conio.h>
#include<dos.h>
#include<string.h>

int get_menu(char *str,char *title,int cho_def,int effect_time,int text_color,int title_color,int border_color,int choice_color){
if(*str=='\0')
return 0;
int j,rtn=1,val_line=0,x_start,y_start,x_size,y_size,y _lines[100];
char ch_key;
struct text_info screen_info;

choice_color+=128;

gettextinfo(&screen_info);

x_start=screen_info.curx;
y_start=screen_info.cury;

x_size=screen_info.curx;
y_size=screen_info.cury;

_setcursortype(_NOCURSOR);

//print text of menu:
textcolor(text_color);
if(*title)
cprintf("\n\n\n");
else
cprintf("\n");
while(*str){
delay(effect_time);
if(val_line==0){
gotoxy(x_start+4,wherey());
val_line++;
y_lines[val_line-1]=wherey();

}
if((*str==',')){
if(*(str+1)==','){
cprintf(",");
str+=2;
}
else{
gotoxy(x_start+4,wherey()+2);
val_line++;
y_lines[val_line-1]=wherey();
str++;
}
}
else{
putch(*str);
str++;
}
x_size=wherex()>x_size ? wherex() : x_size;
}
y_size=wherey()>y_size ? wherey() : y_size;
x_size-=x_start;
y_size-=y_start;
y_size++;
textcolor(title_color);
if(*title){
x_size=strlen(title)+5>x_size ? strlen(title)+5 : x_size;
gotoxy(((x_size+2)-strlen(title)+1)/2,y_start+1);
cprintf("%s",title);
}

//Draw border:
textcolor(border_color);
gotoxy(x_start,y_start);
putch(201);
gotoxy(x_start+x_size,y_start);
putch(187);
for(j=y_start+1;j<y_start+y_size;j++){
delay(effect_time);
if((j==y_start+2)&&(*title!='\0')){
gotoxy(x_start,j);
putch(199);
gotoxy(x_start+x_size,j);
putch(182);
}
else{
gotoxy(x_start,j);
putch(186);
gotoxy(x_start+x_size,j);
putch(186);
}
}
gotoxy(x_start,y_start+y_size);
putch(200);
gotoxy(x_start+x_size,y_start+y_size);
putch(188);
for(j=x_start+1;j<x_start+x_size;j++){
delay(effect_time);
gotoxy(j,y_start);
putch(205);
if(*title!='\0'){
gotoxy(j,y_start+2);
putch(196);
}
gotoxy(j,y_start+y_size);
putch(205);
}
textcolor(choice_color);
if(cho_def>val_line)
rtn=val_line;
else if(cho_def<1)
rtn=1;
else
rtn=cho_def;
do{
gotoxy(x_start+2,y_lines[rtn-1]);
putch(16);
ch_key=getch();
if(ch_key==0)
ch_key=getch();
if((ch_key==72)&&(rtn>1)){
gotoxy(x_start+2,y_lines[rtn-1]);
putch(' ');
rtn--;
gotoxy(x_start+2,y_lines[rtn-1]);
putch(16);
}
else if((ch_key==80)&&(rtn<val_line)){
gotoxy(x_start+2,y_lines[rtn-1]);
putch(' ');
rtn++;
gotoxy(x_start+2,y_lines[rtn-1]);
putch(16);
}

}while(ch_key!=13);
textcolor(choice_color-128);
gotoxy(x_start+2,y_lines[rtn-1]);
putch(4);

gotoxy(x_start,y_start+y_size+1);
normvideo();
_setcursortype(_NORMALCURSOR);
return rtn;

}

چرا توی هر کامپایلری اجرا میکنم جواب نمی ده و اخطار میده!
عکس برنامهhttp://barnamenevis.org/attachment.php?attachmentid=19471&d=1214154294

توی عکس نشون میده که توی ویندوز قابله اجراست ولی چرا هی ارور میگیره