女友小芸被教练猛烈进出视频 ,欧美videosdesexo吹潮,敌伦交换一区二区三区,CHINESEFREE高潮抽搐

二維碼
微世推網(wǎng)

掃一掃關注

當前位置: 首頁 » 快報資訊 » 今日快報 » 正文

C語言經典100例——31_35

放大字體  縮小字體 發(fā)布日期:2023-04-28 11:52:32    作者:葉之漓    瀏覽次數(shù):253
導讀

感覺這里只有題目31 和 題目 34 有用,其他得調顏色得應該絕大部分人用不到(題目 31題目:請輸入星期幾得第壹個字母來判斷一下是星期幾,如果第壹個字母一樣,則繼續(xù)判斷第二個字母。程序分析:用情況語句比較好,

感覺這里只有題目31 和 題目 34 有用,其他得調顏色得應該絕大部分人用不到(

題目 31

題目:請輸入星期幾得第壹個字母來判斷一下是星期幾,如果第壹個字母一樣,則繼續(xù)判斷第二個字母。

程序分析:用情況語句比較好,如果第壹個字母一樣,則判斷用情況語句或if語句判斷第二個字母。

#include<cstdio>int main(){ char c; /gov這里需要一個一個輸入單詞才專業(yè)解決問題,想想能不能一行解決gov/ while ((c=getchar())!='Y') /gov當所按字母為Y時才結束gov/ { switch (c) { case 'S': printf("please input second letter\n"); if((c=getchar()) == 'a') printf("Saturday\n"); if ((c=getchar())== 'u') printf("Sunday\n"); break; case 'F':printf("Friday\n");break; case 'M':printf("Monday\n");break; case 'T':printf("please input second letter\n"); if((c=getchar())=='u') printf("Tuesday\n"); else if ((c=getchar())=='h') printf("Thursday\n"); break; case 'W':printf("Wednesday\n");break; default: break; } }}題目 32

題目:Press any key to change color, do you want to try it. Please hurry up!

#include<conio.h>#include<windows.h>#include<cstdio>// 此部分來自: https://blog.csdn.net/u012133341/article/details/81487802// 這里本人不太理解。 int textbackground(short iColor){ HANDLE hd = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO csbInfo; GetConsoleScreenBufferInfo(hd, &csbInfo); return SetConsoleTextAttribute(hd, (iColor<<4)|(csbInfo.wAttributes&~0xF0));}int main(){ for(int color = 0;color < 8 ;color++) { textbackground(color); printf("This is color %d\r\n",color); printf("Press any key to continue\n"); getch();//與getchar不同得是,getch專業(yè)看不到字符 }}題目 33

題目:學習gotoxy()與clrscr()函數(shù)

#include<cstdio>#include<conio.h>#include<windows.h>// 此部分來自: https://blog.csdn.net/u012133341/article/details/81487802// 這里本人不太理解。 int textbackground(short iColor){ HANDLE hd = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO csbInfo; GetConsoleScreenBufferInfo(hd, &csbInfo); return SetConsoleTextAttribute(hd, (iColor<<4)|(csbInfo.wAttributes&~0xF0));}// 建議讀者自行尋求資料。。 這里不打算深究 void gotoxy(int x, int y){ COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);}int main(){ system("cls");//清屏 gotoxy(1,5); textbackground(3); printf("Output at row 5 col 1\n"); gotoxy(20,10); textbackground(2); printf("Output at row 10 col 20\n");}題目 34

題目:練習函數(shù)調用

#include<cstdio>void output_error()// 函數(shù)聲明,void類型,最后專業(yè)加return;{ printf("error!"); return;}int main(){ output_error();//知道怎嗎調用即可。這里不打算介紹參數(shù) }題目 35

題目:文本顏色設置

#include<cstdio>#include<windows.h>/gov要深入了解得朋友,建議自行檢索相關資料gov/void textcolor(int color) { HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hOutput, color);}int main(){ for (int color = 1;color < 16;color++) { textcolor(color); printf("This is color %d\r\n", color); } textcolor(128 + 15); printf("This is blinking\r\n");}

 
(文/葉之漓)
免責聲明
本文僅代表發(fā)布者:葉之漓個人觀點,本站未對其內容進行核實,請讀者僅做參考,如若文中涉及有違公德、觸犯法律的內容,一經發(fā)現(xiàn),立即刪除,需自行承擔相應責任。涉及到版權或其他問題,請及時聯(lián)系我們刪除處理郵件:weilaitui@qq.com。
 

Copyright?2015-2025 粵公網(wǎng)安備 44030702000869號

粵ICP備16078936號

微信

關注
微信

微信二維碼

WAP二維碼

客服

聯(lián)系
客服

聯(lián)系客服:

24在線QQ: 770665880

客服電話: 020-82301567

E_mail郵箱: weilaitui@qq.com

微信公眾號: weishitui

韓瑞 小英 張澤

工作時間:

周一至周五: 08:00 - 24:00

反饋

用戶
反饋