9 Replies - 786 Views - Last Post: 04 September 2009 - 05:47 AM Rate Topic: -----

#1 denil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-September 09

c++ graphic error

Posted 03 September 2009 - 10:17 PM

error



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
Is This A Good Question/Topic? 0
  • +

Replies To: c++ graphic error

#2 DaneAU  Icon User is offline

  • Great::Southern::Land
  • member icon

Reputation: 278
  • View blog
  • Posts: 1,588
  • Joined: 15-May 08

Re: c++ graphic error

Posted 03 September 2009 - 10:25 PM

You will need to post code in order for people to help you denil :)
Was This Post Helpful? 0
  • +
  • -

#3 denil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-September 09

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 :code: ***

This post has been edited by JackOfAllTrades: 04 September 2009 - 05:37 AM

Was This Post Helpful? 0
  • +
  • -

#4 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: c++ graphic error

Posted 04 September 2009 - 12:10 AM

Could you show us the complete error, or the debug?

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
Was This Post Helpful? 0
  • +
  • -

#5 denil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-September 09

Re: c++ graphic error

Posted 04 September 2009 - 12:49 AM

while compiling they will shows no error.Then i try to run then program
c++ window closes and shows this message :blink:

the ntvdm cpu has encountered an illegal instruction
cs :0000 ip:0077 op:fo37 05 0e 02 choose 'close' to terminate the application :crazy:


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.. ;)
Was This Post Helpful? 0
  • +
  • -

#6 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: c++ graphic error

Posted 04 September 2009 - 12:55 AM

Fix your post using the code tags and use the new code you have its hard to read the way its posted
Exaple[code] Code goes here [/code]
Was This Post Helpful? 0
  • +
  • -

#7 denil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-September 09

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 

Was This Post Helpful? 0
  • +
  • -

#8 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 289
  • View blog
  • Posts: 1,898
  • Joined: 25-October 06

Re: c++ graphic error

Posted 04 September 2009 - 02:36 AM

if I change the initgraph() to
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

Was This Post Helpful? 0
  • +
  • -

#9 denil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-September 09

Re: c++ graphic error

Posted 04 September 2009 - 04:46 AM

that solves the problem thanx sir 

Was This Post Helpful? 0
  • +
  • -

#10 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: c++ graphic error

Posted 04 September 2009 - 05:47 AM

I dont know if im reading wrong or something but isnt this supposed to have a type?
menu()
{
xpos=maxx/2;
ypos=maxy/2;
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1