c++ graphic error
Page 1 of 19 Replies - 786 Views - Last Post: 04 September 2009 - 05:47 AM
#1
c++ graphic error
Posted 03 September 2009 - 10:17 PM
the ntvdm cpu has encountered an illegal instruction
cs :0000 ip:0077 op:fo37 05 0e 02 choose 'close' to terminate the application
plz help me
Replies To: c++ graphic error
#2
Re: c++ graphic error
Posted 03 September 2009 - 10:25 PM
#3
Re: c++ graphic error
Posted 03 September 2009 - 11:46 PM
#include<graphics.h>
#include<conio.h>
class Draw
{
protected:
int gd,gm,maxx,maxy;
public:
Draw()
{
gd=DETECT;
initgraph(&gd,&gm,"c:\\tcc\\bgi");
maxx=getmaxx();
maxy=getmaxy();
}
};
class menu:Draw
{
int xpos,ypos,choice;
public:
menu()
{
xpos=maxx/2;
ypos=maxy/2;
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
}
void displaymenu();
};
void menu::displaymenu()
{
setcolor(LIGHTRED);
rectangle(5,5,maxx-5,maxy-5);
setfillstyle(SOLID_FILL,BLUE);
bar(xpos,ypos,xpos+50,ypos+35);
setcolor(YELLOW);
outtextxy(xpos+5,ypos+5,"EXIT");
}
int main()
{
menu mymenu;
mymenu.displaymenu();
getch();
closegraph();
return(0);
}
*** MOD EDIT: Added code tags. Please
This post has been edited by JackOfAllTrades: 04 September 2009 - 05:37 AM
#4
Re: c++ graphic error
Posted 04 September 2009 - 12:10 AM
By the way fix your post using code tags.
And one other thing
initgraph(&gd,&gm,"c:\\tcc\\bgi");//are you sure is tcc?
return 1;//fix your return (0) and do this
#5
Re: c++ graphic error
Posted 04 September 2009 - 12:49 AM
c++ window closes and shows this message
the ntvdm cpu has encountered an illegal instruction
cs :0000 ip:0077 op:fo37 05 0e 02 choose 'close' to terminate the application
as u said earlier i fix return0 with rerurn1 and i run the program,
now this time i got some result but not the actual one
the result is some dot moving here and there in my screen
what can i do now..
#6
Re: c++ graphic error
Posted 04 September 2009 - 12:55 AM
Exaple[code] Code goes here [/code]
#7
Re: c++ graphic error
Posted 04 September 2009 - 02:08 AM
#include<graphics.h>
#include<conio.h>
class Draw
{
protected:
int gd,gm,maxx,maxy;
public:
Draw()
{
gd=DETECT;
initgraph(&gd,&gm,"c:\\tcc\\bgi");
maxx=getmaxx();
maxy=getmaxy();
}
};
class menu:Draw
{
int xpos,ypos,choice;
public:
menu()
{
xpos=maxx/2;
ypos=maxy/2;
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
}
void displaymenu();
};
void menu::displaymenu()
{
setcolor(LIGHTRED);
rectangle(5,5,maxx-5,maxy-5);
setfillstyle(SOLID_FILL,BLUE);
bar(xpos,ypos,xpos+50,ypos+35);
setcolor(YELLOW);
outtextxy(xpos+5,ypos+5,"EXIT");
}
int main()
{
menu mymenu;
mymenu.displaymenu();
getch();
closegraph();
return(0);
}
now i get some dot moving in screen.i am using a agp card 256 mb nvidia
#8
Re: c++ graphic error
Posted 04 September 2009 - 02:36 AM
initgraph(&gd,&gm,"c:\\tc\\bgi");
the screen clears to black and EXIT appears in a blue box in the middle of the screen
rather than using the old DOS Turbo C Version 3 I would recommend you switch to Code::Blocks
http://www.codeblocks.org/
which support a graphics library with similar functionality to Turbo C
http://www.cs.colora.../bgi/index.html
the only modification I made to you program to get it to compile and run was to replace
initgraph(&gd,&gm,"c:\\tc\\bgi");
with
initwindow(600,400); //open graphics window
This post has been edited by horace: 04 September 2009 - 03:13 AM
#9
Re: c++ graphic error
Posted 04 September 2009 - 04:46 AM
that solves the problem thanx sir
#10
Re: c++ graphic error
Posted 04 September 2009 - 05:47 AM
menu()
{
xpos=maxx/2;
ypos=maxy/2;
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
}
|
|

New Topic/Question
Reply




MultiQuote






|