c语言中图形驱动程序功能_C / C ++中的图形:一些更有趣的功能

c语言中图形驱动程序功能

In this Advance Learning Tutorial of C / C ++ today, we are going to tell you about some of the functions that can be used to make the program more attractive. This works on both text and graphics modes. That is why knowing these functions before starting the graphics programming is important and also useful.

在今天的C / C ++高级学习教程中,我们将向您介绍一些可用于使程序更具吸引力的功能。 这适用于文本和图形模式。 这就是为什么在开始图形编程之前了解这些功能很重要而且很有用的原因。

1)闪烁 (1) BLINK)

We will talk about an interesting character. You must have heard about the word 'BLINKING'. If you also want to blink any character on your screen, it is possible in C / C++ as well.

我们将讨论一个有趣的角色。 您必须听说过“闪烁”一词。 如果您还想让屏幕上的任何字符闪烁,那么在C / C ++中也可以。

A constant word 'BLINK' is defined in C / C ++. With the help of which you can blink any character on the screen. The value of BLINK constant is 128. Here is given an example which shows the usage of 'BLINK'.

在C / C ++中定义了常量字“ BLINK”。 借助它,您可以使屏幕上的任何字符闪烁。 BLINK常数的值为128。这里给出一个示例,说明“ BLINK”的用法。

    textcolor( BLUE + BLINK );
OR
textcolor( Blue + 128 );  

Keep in mind that the BLINK character is used only with textcolor and textbackground functions on TEXT MODE. So writing only BLINK will not make any difference. You can also write value 128 at the place of BLINK. This works in both ways.

请记住,BLINK字符仅与TEXT MODE上的textcolor和textbackground函数一起使用。 因此,仅编写BLINK不会有任何区别。 您也可以在BLINK处写入值128。 这在两种方式下都有效。

See the program below and try it out...

请参阅下面的程序并尝试...

#include <conio.h> 
void main() {
clrscr();
textcolor(BLUE + BLINK );
cprintf("Welcome to the Tutorial of Graphics\n");
getch(); 
}

After running this program you will see the ' Welcome In Advance Learning Tutorial' line in the output.

运行该程序后,您将在输出中看到“欢迎高级学习教程”行。

2)GOTOXY (2) GOTOXY)

Now let's talk about a function with which you can move the cursor to any position on the screen. It is better to understand this function properly as it is useful for creating a program in graphics. The name of this function is gotoxy. Its declaration is given below,

现在让我们讨论一个函数,通过该函数可以将光标移动到屏幕上的任何位置。 最好正确理解此功能,因为它对于在图形中创建程序很有用。 该函数的名称是gotoxy。 其声明如下:

    void gotoxy(int x , int y); 

This function takes two parameters x, y whatever value you give in x and y, the function will take the cursor to that position. Keep in mind that if you pass an invalid coordinate, then using this function will not make any sense because the compiler will ignore it.

无论您在x和y中输入的值是多少,该函数都会使用两个参数x,y,该函数会将光标移到该位置。 请记住,如果传递无效的坐标,则使用此函数没有任何意义,因为编译器将忽略它。

See the example below to see how to use the function:

请参见下面的示例,以了解如何使用该函数:

Note: Do not forget to include Header File <conio.h> before using this function.

注意:在使用此功能之前, 不要忘记包含头文件<conio.h>。

#include <conio.h> 
#include <stdio.h>
void main() {
clrscr();
gotoxy(20,12);
printf("Welcome to the Tutorial of Graphics\n");
getch(); 
}

Keep in mind that in this example we use printf function instead of cprintf. This is why stdio.h header file has been used. gotoxy works with both printf and cprintf.

请记住,在此示例中,我们使用printf函数而不是cprintf。 这就是为什么使用stdio.h头文件的原因。 gotoxy可与printf和cprintf一起使用。

3)延迟 (3) DELAY)

Now we will be telling you about another important function, which delay(), with the help of which you can suspend the execution of the program for some time. You must be wondering how long will the execution of the program be suspended?

现在,我们将告诉您另一个重要的函数,delay(),借助它您可以暂停程序的执行一段时间。 您一定想知道程序的执行将被暂停多长时间?

Well, it depends on the value passed in the parameter of this function. Delay function takes value in the millisecond. That is, if you want to suspend the program for 5 seconds then the function call will be as follows:

好吧,这取决于在此函数的参数中传递的值。 延迟功能的值以毫秒为单位。 也就是说,如果您要暂停程序5秒钟,则函数调用将如下所示:

    delay (5000); 

After writing this line, if any line is written below, it will be executed after 5 seconds because the execution of the program will be suspended for 5 seconds.

写入此行后,如果在下面写入任何行,则将在5秒钟后执行,因为该程序的执行将被暂停5秒钟。

Note: You must include the header file (DOS.H) before using the function. For example, see the program given below.

注意:使用该函数之前,必须包括头文件(DOS.H)。 例如,请参见下面给出的程序。

#include <conio.h> 
#include <stdio.h>
#include <dos.h>
void main() {
clrscr();
printf("Welcome\n");
delay(5000);
printf("You are learning Graphics in C/C++\n");
getch(); 
}

After running the program, first, you will see Welcome in the output, after 5 seconds, the next line will be You are learning Graphics in C/C++.

运行该程序之后,首先,您将在输出中看到Welcome,5秒后,下一行将是You are learning学习C / C ++。

If you have any problems understanding the basic topics of C/C ++ such as printf, header file and function etc, then you can read these basic topics from our website too.

如果您在理解C / C ++的基本主题(例如printf,头文件和函数等)时遇到任何问题,那么您也可以从我们的网站上阅读这些基本主题。

That's all for today in Advance Learning Tutorial. If you have any problem in any of the topics mentioned above, then you can ask your questions in the comments section below.

今天就在高级学习教程中。 如果您对上述主题有任何疑问,可以在下面的评论部分中提问。

翻译自: https://www.includehelp.com/c/interesting-graphics-functions.aspx

c语言中图形驱动程序功能

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/378596.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php 载入css就可以显示,如何在进度条加载后显示页面

1.思路&#xff1a;加入很多图片&#xff0c;以延迟加载时间&#xff0c;实现加载完后显示图片。定义一个外层p&#xff0c;覆盖住图片&#xff0c;在内层p中引入加载时显示的图片&#xff0c;让内层p居中在页面上&#xff0c;利用setInterval定时器设置3秒后将外层p隐藏&#…

如何获取轮廓(连通域)的面积、周长、矩形度、圆形度、宽长比、周径比等形状描述符?

博主联系方式&#xff1a; QQ:1540984562 QQ交流群&#xff1a;892023501 群里会有往届的smarters和电赛选手&#xff0c;群里也会不时分享一些有用的资料&#xff0c;有问题可以在群里多问问。 目录前言1、轮廓面积获取函数2、轮廓周长获取函数3、轮廓圆形度计算4、矩形度计算…

01-基础部分

一、tensorflow和opencv测试 import tensorflow as tf import cv2hello tf.constant(hello tensorflow) session tf.Session() print(session.run(hello))print(hello opencv)运行效果如下&#xff1a; 二、基础部分 1、opencv基础 代码三部曲&#xff1a; 1、引入Open…

网络和通信 - Silverlight 中的 HTTP 通信和安全

Silverlight 支持几种使用 HTTP/HTTPS 的方案。虽然可以使用多种方式和技术执行 HTTP 调用&#xff0c;但是下表描述的是针对这些 HTTP 通信方案的建议方法 执行 HTTP 调用的选项 确定应由浏览器还是客户端来执行应用程序的 HTTP 处理后&#xff0c;应在创建任何 Web 请求之前指…

linux下g++和gcc_Linux中gcc和g ++有什么区别?

linux下g和gccgcc和g 之间的区别 (Difference between gcc and g) Both are the compilers in Linux to compile and run C and C programs. Initially gcc was the GNU C Compiler but now a days GCC (GNU Compiler Collections) provides many compilers, two are: gcc and …

WT2605C高品质音频蓝牙语音芯片:外接功放实现双声道DAC输出的优势

在音频处理领域&#xff0c;双声道DAC输出能够提供更为清晰、逼真的音效&#xff0c;增强用户的听觉体验。针对这一需求&#xff0c;唯创知音的WT2605C高品质音频蓝牙语音芯片&#xff0c;通过外接功放实现双声道DAC输出&#xff0c;展现出独特的应用优势。 一、高品质音频处理…

对c++primer 16.6.1的第4小节的代码说明

这段代码是这样的: template<typename T>int compare(const T& t1,const T& t2){ cout<<"范型"<<endl; return 1;} int main(){   cout<<compare("hello","world")<<endl;} template<> int compa…

php curl form-data,在php curl multipart / form-data请求中发送一个文件和json数据

我正在尝试在PHP的curl请求中上传文件和json数据 . 请求在命令行中使用curl正常工作 . 这是命令行中的curl请求&#xff1a;curl -v --basic -uusername -F file"documentTest.pdf;typeapplication/octet-stream" -F data{"nomDocument":"test.pdf&qu…

角点检测(Harris角点检测法)

博主联系方式&#xff1a; QQ:1540984562 QQ交流群&#xff1a;892023501 群里会有往届的smarters和电赛选手&#xff0c;群里也会不时分享一些有用的资料&#xff0c;有问题可以在群里多问问。 目录原理讲解【1】为何选取角点作为特征&#xff1f;【2】角点的定义&#xff1a;…

02-图像的几何变换

一、图片缩放 imageInfo&#xff1a;图片宽、高、通道个数等 缩放&#xff1a; 等比例缩放&#xff1a;宽高比不变 任意比例缩放&#xff1a;图片拉伸、非拉伸 窗体大小 实现步骤&#xff1a; 1&#xff0c;完成图像的加载&#xff0c;拿到图像的数据信息 2&#xff0c;图片的宽…

c ++查找字符串_C ++数组| 查找输出程序| 套装5

c 查找字符串Program 1: 程序1&#xff1a; #include <iostream>using namespace std;int main(){char* STR[] { "HELLO", "HIII", "RAM", "SHYAM", "MOHAN" };cout << (*STR 2)[2];return 0;}Output: 输出&…

MSSQL 链接Oracle 表

在Oracle中&#xff0c;要访问远程的另外一台数据库的话&#xff0c;是建立DBlink的方式。 在MSSQL中&#xff0c;则是以建立“link server 链接服务器”来远程访问另外一台数据库。 现在从MSSQL 2005访问Oracle的scott.dept。 首先&#xff0c;安装Oracle的客户端PLSQL DEVELO…

SQL Server 2008 高可用性视频(四)-- 故障转移群集

做数据库的朋友都知道, 其实数据库的工作大致可以分为三类: 数据库设计与开发, 数据库管理, 数据库商业智能. 其中数据库管理的工作大部分是由DBA在做, DBA们除了要保证正常的数据库运行, 还要采取必要措施提升数据库的性能, 比如数据库的性能优化, 以及保证数据库系统的高可用…

php 虚拟空间,什么是php虚拟主机?

什么是php虚拟主机&#xff1f;什么是php虚拟主机Php虚拟主机简单来说就是支持php语言开发的虚拟主机&#xff0c;我们把它称为php虚拟主机。php虚拟主机的工作原理Php是一种html嵌入式的语言&#xff0c;是一种在服务器端执行的嵌入html文档的脚本语言&#xff0c;类似于c语言…

C++---肿瘤面积

【问题描述】 在一个正方形的灰度图片上&#xff0c;肿瘤是一块矩形的区域&#xff0c;肿瘤的边缘所在的像素点在图片 中用 0 表示。其它肿瘤内和肿瘤外的点都用 255 表示。现在要求你编写一个程序&#xff0c;计算肿瘤内部的像素点的个数&#xff08;不包括肿瘤边缘上的点&am…

微机原理——8086中断类型以及中断向量表、中断响应、中断返回

博主联系方式&#xff1a; QQ:1540984562 QQ交流群&#xff1a;892023501 群里会有往届的smarters和电赛选手&#xff0c;群里也会不时分享一些有用的资料&#xff0c;有问题可以在群里多问问。 目录先验知识回顾控制寄存器回顾1、8086中断类型1、外部可屏蔽中断2、外部不可屏蔽…

著名开源项目_著名开源项目案例研究

著名开源项目维基百科 (Wikipedia) Wikipedia is no less than an encyclopedia available free of cost to the public nowadays. If you want to write a passage, know about some famous person or thing you are just one click away from your desired article. 维基百科…

资料整理-工具篇

* 代码利器 Resharper 作为一个C#er&#xff0c;非常感谢有Resharper这样的代码利器。在VS系列的IDE中&#xff0c;使用Resharper后&#xff0c;你会发现&#xff0c;原来写代码也可以是一种享受&#xff01; 1. 首先&#xff0c;下载Resharper。下载地址&#xff1a;http://ww…

企业级php第三方支付平台,ThinkPHP新版企业级php第三方api第四方支付平台程序源码商业版 带接口文件等 某宝售价3000元...

本帖最后由 商业源码网 于 2017-12-21 11:23 编辑7 h$ . , C u0 R3 R y$ z! ] q( D D$ s( Y源码说明&#xff1a;) G: y; R# G0 0 g N. ; \0 w, A9 {5 # P今天黑锐给大家分享给好东西&#xff01;很不错的支付系统&#xff01;喜欢研究支付接口的朋友别错过&#xff01;ThinkP…

C++---两数之和

【问题描述】 给定一个整数数组 nums 和一个整数目标值 target&#xff0c;请你在该数组中找出 和为目标值 target 的那 两个 整数&#xff0c;并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是&#xff0c;数组中同一个元素在答案里不能重复出现。 【输入形…