-6

In turbo c 3.2 I am getting

Divide error

and in code blocks IDE I getting error that

initgraph() and closegraph() are refrence at compile time. (I added graphics header and library file in folder of codeblocks).Please give me solution?

the code i written is

#include<graphics.h>
int main()
{
   int a=10,ab;
   initgraph(&a,&ab,"C:\\TURBOC3\\BGI");
   circle(100,200,20);
   closegraph();
   return 0;
 }
genpfault
  • 51,148
  • 11
  • 85
  • 139
KD.
  • 61
  • 6
  • 4
    It's very hard to tell what you're trying to do and what it wrong. Please include a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Marc Jan 03 '18 at 11:36
  • And you should copy and paste error messages exactly. – HolyBlackCat Jan 03 '18 at 11:38
  • 6
    Turbo C is ancient history by now. So is the `"graphics.h"` header file and the library. What you learn from using them will have no (or very little) practical bearing on your life later as a programmer. – Some programmer dude Jan 03 '18 at 11:38
  • 1
    Turbo C was discontinued ages ago. Do yourself a favor and use something else. – klutt Jan 03 '18 at 11:42
  • 3
    I have colleagues that are younger than that compiler. Please get a book or teacher that teaches this centuries' programming. – nvoigt Jan 03 '18 at 11:43
  • "_I uploaded the picture of error on turbo C_" **Don't** post pictures of errors: **copy-paste** them. – Algirdas Preidžius Jan 03 '18 at 11:47
  • @Klutt turbo C discontinued but no IDE supporting graphics. h header file and to manually include it – KD. Jan 03 '18 at 11:48
  • 2
    Possible duplicate of [BGI in computer graphics](https://stackoverflow.com/questions/37322352/bgi-in-computer-graphics) – David Hoelzer Jan 03 '18 at 11:50
  • @david I seen that but still getting error and now saying divide error – KD. Jan 03 '18 at 11:54
  • @kd vote retracted and possible answer posted. – David Hoelzer Jan 03 '18 at 11:59

2 Answers2

1

In addition to the backslash issue in the path, it's extremely unlikely that you are using a 3270 compatible display. Why don't you pass in the address of a with a=0. ab must be set to a requested mode unless you set the driver to autodetect, which will then select the highest available mode. See here.

David Hoelzer
  • 15,862
  • 4
  • 48
  • 67
0

The path string should be "C:\\TURBOC3\\BGI" (note the double backslashes instead of single backslashes)
I hope this solves the problem. I can't see any other error in code.

Gaurav Singh
  • 456
  • 6
  • 17