日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時間:2023/12/1 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言中图形驱动程序功能_C / C ++中的图形:一些更有趣的功能 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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常數(shù)的值為128。這里給出一個示例,說明“ BLINK”的用法。

textcolor( BLUE + BLINK );ORtextcolor( 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函數(shù)一起使用。 因此,僅編寫B(tài)LINK不會有任何區(qū)別。 您也可以在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,

現(xiàn)在讓我們討論一個函數(shù),通過該函數(shù)可以將光標移動到屏幕上的任何位置。 最好正確理解此功能,因為它對于在圖形中創(chuàng)建程序很有用。 該函數(shù)的名稱是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中輸入的值是多少,該函數(shù)都會使用兩個參數(shù)x,y,該函數(shù)會將光標移到該位置。 請記住,如果傳遞無效的坐標,則使用此函數(shù)沒有任何意義,因為編譯器將忽略它。

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

請參見下面的示例,以了解如何使用該函數(shù):

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函數(shù)而不是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?

現(xiàn)在,我們將告訴您另一個重要的函數(shù),delay(),借助它您可以暫停程序的執(zhí)行一段時間。 您一定想知道程序的執(zhí)行將被暫停多長時間?

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:

好吧,這取決于在此函數(shù)的參數(shù)中傳遞的值。 延遲功能的值以毫秒為單位。 也就是說,如果您要暫停程序5秒鐘,則函數(shù)調用將如下所示:

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秒鐘后執(zhí)行,因為該程序的執(zhí)行將被暫停5秒鐘。

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

注意:使用該函數(shù)之前,必須包括頭文件(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,頭文件和函數(shù)等)時遇到任何問題,那么您也可以從我們的網(wǎng)站上閱讀這些基本主題。

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語言中圖形驅動程序功能

總結

以上是生活随笔為你收集整理的c语言中图形驱动程序功能_C / C ++中的图形:一些更有趣的功能的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。