GCC Debugging/g++/Warnings/deprecated conversion from string constant
Appearance
//This code is developed by SOBAN //!!! you need to must add th graphics.h lib to run this code //for tutorial visit mu chennel: soban can code //for further queries WA me: 0325-4300011 //subscribe for support:soban can code
- include <stdio.h>
- include <conio.h>
- include <iostream>
- include <graphics.h>
using namespace std;
// Function to draw an ellipse using midpoint ellipse drawing algorithm void drawEllipseMidpoint(int xCenter, int yCenter, int radiusX, int radiusY) {
int x = 0; int y = radiusY; int p; int px = 0; int py = 2 * radiusX * radiusX * y;
// Region 1 p = radiusY * radiusY - (radiusX * radiusX * radiusY) + (0.25 * radiusX * radiusX);
while (px < py) { putpixel(xCenter + x, yCenter - y, GREEN); putpixel(xCenter - x, yCenter - y, GREEN); putpixel(xCenter + x, yCenter + y, GREEN); putpixel(xCenter - x, yCenter + y, GREEN);
x++; px += 2 * radiusY * radiusY; if (p < 0) p += radiusY * radiusY + px; else { y--; py -= 2 * radiusX * radiusX; p += radiusY * radiusY + px - py; } }
// Region 2 p = radiusY * radiusY * (x + 0.5) * (x + 0.5) + radiusX * radiusX * (y - 1) * (y - 1) - radiusX * radiusX * radiusY * radiusY;
while (y >= 0) { putpixel(xCenter + x, yCenter - y, GREEN); putpixel(xCenter - x, yCenter - y, GREEN); putpixel(xCenter + x, yCenter + y, GREEN); putpixel(xCenter - x, yCenter + y, GREEN);
y--; py -= 2 * radiusX * radiusX; if (p > 0) p += radiusX * radiusX - py; else { x++; px += 2 * radiusY * radiusY; p += radiusX * radiusX - py + px; } }
}
int main() {
int gd = DETECT, gm; initgraph(&gd, &gm, ""); outtextxy(180, 180, "ID: BC200400812 ");
// Set fill style to custom pattern fill setfillstyle(USER_FILL, GREEN);
// Create a custom pattern char pattern[8] = { 0b11000011, 0b11111111, 0b11111111, 0b11000011, 0b00000000, 0b00000000, 0b11000011, 0b11111111};
// Set the custom pattern setfillpattern(pattern, GREEN);
// Draw and fill the ellipse with a design drawEllipseMidpoint(250, 250, 100, 50); floodfill(250, 250, GREEN);
// Pause the screen getch();
// Close the graphics window closegraph();
return 0;
}