Cant solve this problem

Discussion in 'C++' started by danidaca, Sep 14, 2015.

  1. danidaca

    danidaca New Member

    Joined:
    Sep 12, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi guys, I'm new here. I've started learning C++ few days ago, and I just cant solve this problem i have with winbgim.h.

    There is no way i can run any graphic program i make. Its always the same mistake with initgraph.

    Here is one example of my code...

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <winbgim.h>
    #include <ctime>
    
    using namespace std;
    
    int main()
    
    {
    	int x;
    	int sx;
    	int sy;
    	int gdriver=6;
    	int gmode=0;
    	initgraph(&gdriver,&gmode,"");
    	setbkcolor(WHITE);
    	setcolor(BLACK);
    	cleardevice();
    	srand(time(NULL));
    	rand();
    	
    	for (x=1;x<60;x=x+1)
    	{
    		sx=(static_cast <float> (rand()))/RAND_MAX*640;
    		sy=(static_cast <float> (rand()))/RAND_MAX*480;
    		circle(sx,sy,30);
    		
    	}
    	
    	getch();
    	closegraph();
    	return 0;
    	
    	
    }
    I'm sorry for My english, and for stupid question. :cryin:

    Thanks in advance!
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    What exactly goes wrong? Does the code compile OK, or do you get any errors?
    If you get errors, what are they?
    If it compiles OK, what goes wrong at runtime? What are you expecting to see? What do you actually see?

    Also it would help if you give some idea of the operating system you're using and which compiler (include versions of both).
     
  3. danidaca

    danidaca New Member

    Joined:
    Sep 12, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    There was a problem with winbgim.h, solved it :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice