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.pswp.cn/news/378596.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378596.shtml
英文地址,請注明出處:http://en.pswp.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;數組中同一個元素在答案里不能重復出現。 【輸入形…