In this post I am going to illustrate the process to run C graphics program in Code::Block. If you want to run C graphics in Dev-C++, you may check out my previous blog post on how to run C graphics program in Dev-C++.
Process:
1) Download the Code::Blocks EDU-Portable Version(CodeBlocks-EP) and Install It.
(http://codeblocks.codecutter.org/)
2) Create a new project on CodeBlocks-EP
(File->New->project...-> Select WinBGIm Project Category->Click on Go->Next)
3) Then give your project name(say my_first_gproject) and click on Next->Finish
4) Add a file(say test_prog.c) to project
(File->New->Empty FIle->Yes->test_prog.c->Save)
5) Write the following code on first_prog.c:
#include<stdio.h>
>>To learn more about C graphics program, you may visit the following links:
!!!Happy Coding!!!
Process:
1) Download the Code::Blocks EDU-Portable Version(CodeBlocks-EP) and Install It.
(http://codeblocks.codecutter.org/)
2) Create a new project on CodeBlocks-EP
(File->New->project...-> Select WinBGIm Project Category->Click on Go->Next)
3) Then give your project name(say my_first_gproject) and click on Next->Finish
4) Add a file(say test_prog.c) to project
(File->New->Empty FIle->Yes->test_prog.c->Save)
5) Write the following code on first_prog.c:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int main()
{
int gMode, gDriver = DETECT;
initgraph(&gDriver, &gMode, "");
line(0, getmaxy()/2, getmaxx(),getmaxy()/2);
line(getmaxx()/2, 0, getmaxx()/2,getmaxy());
circle(getmaxx()/2, getmaxy()/2, 130);
getch();
closegraph();
return 0;
}
6) Compile and run program
>>To learn more about C graphics program, you may visit the following links: