Graphics in C++ - Mohammed Ihsan
Graphics in C++ - Mohammed Ihsan
Nineveh University
College of Electronics Engineering
Department of Electronic Engineering </>
Medical Instrumentation
<Graphics in C++/>
<Mohammed
Ihsan/>2 Stage
</>
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 1
Introduction to
Graphics in C++
1. Used for creating visual representations and
designs.
*
2. Enables dynamic and interactive content.
3. Popular libraries: graphics.h, SDL, OpenGL,
SFML.
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 2
#include <graphics.h>
#include <conio.h>
4. Draw a circle:
getch();
closegraph();
End of Program
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 7
#include <graphics.h>
#include <conio.h>
void main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
for (int i = 50; i <= 250; i += 50) {
rectangle(i, i, i+40, i+40);
}
getch();
closegraph();
}
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 10
#include <iostream.h>
#include <conio.h>
#include <math.h>
void main() {
double sum = 0;
int n;
cout << "Input n: ";
cin >> n;
for (int i = 1; i <= n; i++) {
sum += 1 / pow(i, i);
}
cout << "Sum of series: " << sum;
getch();
}
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 11
#include <graphics.h>
#include <conio.h>
void main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
for (int x = 50; x <= 400; x += 50) {
if (x == 150 || x == 300) continue;
circle(x, 200, 20);
}
getch();
closegraph();
}
<Graphics in C++/> Medical Instrumentation Mohammed Ihsan 12
Conclusion
• Graphics in C++ demonstrated through loops, conditions,
and bitwise operations.
</>
<THANK’S/>
</>