The header file graphics.h contains putpixel() function which plots a pixel at location (x, y) of specified color.
Syntax :

The header file graphics.h contains drawpoly function which is used to draw polygons i.e. Triangle, rectangle, pentagon, hexagon etc. Syntax: void drawpoly( int number, int.polypoints ); where, number indicates (n + 1) number of points where n is the number of vertices in a polygon. Polypoints points to a sequence of (n.2) integers.

Explanation : A RED color pixel at (50, 40) can be drawn by using putpixel(50, 40, RED). putpixel() function can be used to draw circles, lines and ellipses using various algorithms.

Below is the implementation of putpixel() function.

#include <graphics.h>
intmain()
// gm is Graphics mode which is
// generates image using pixels.
// 'graphics.h' header file
// graphics system by loading a
initgraph(&gd, &gm, ');
// putpixel function
putpixel(30, 40, RED);
putpixel(135, 50, CYAN);
putpixel(20, 100, WHITE);
putpixel(150, 100, LIGHTGREEN);
putpixel(120, 70, RED);
getch();
// closegraph function closes the
// all memory allocated by
closegraph();
return0;

Output :


Function getch in C program prompts a user to press a character. It doesn't show up on the screen. Its declaration is in 'conio.h' header file. The function is not a part of standard C library.

C programming code for getch

#include <stdio.h>
#include <conio.h>

int main()
{
printf('Waiting for a character to be pressed from the keyboard to exit.n');

getch();
return0;
}

Int Function In Dev C 2017

When you run this program, it exits only when you press a character. Try pressing num lock, shift key, etc. (program will not exit if you press these keys) as these are not characters.

Try running the program by removing getch. In this case, it will exit without waiting for a character hit from the keyboard.

How to use getch in C++

#include <iostream.h>Dev
#include <conio.h>

int main()
{
cout <<'Enter a character';
getch();
}

Using getch in Dev C++ compiler

Function getch works in Dev C++ compiler but it doesn't support all functions of 'conio.h' as Turbo C compiler does.

Sep 28, 2018  Can Atif Aslam Could Sing Without Music Or Autotune? Watch Till End Comment Ur Opinions! Get In Touch With Us On Social Media. Sep 04, 2018  50+ videos Play all Mix - Real Voice Without Autotune Bollywood Songs Arijit Singh, Atif Aslam, Armaan Malik YouTube; Best Of. ATIF ASLAM Songs Best Of Atif Aslam. Atif aslam without auto tune. Aug 31, 2017  Funny Interview Of Atif Aslam And Sonu Nigam Must watch - Duration: 4:37. Atif Aslam 318,483 views.

C++ Int Return Function

Function getchar in C

#include <stdio.h>

int main()
{
int c;
c =getchar();
putchar(c);
return0;
}

A common use of getch is you can view the output (if any) of a program without having to open the output window if you are using Turbo C compiler or if you are not running your program from the command prompt.