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

二維碼
微世推網

掃一掃關注

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

C語言經典100例——91_95

放大字體  縮小字體 發(fā)布日期:2023-04-28 11:51:41    作者:田傲飛    瀏覽次數:226
導讀

題目 91題目:時間函數舉例1#includecstdio#includectime //涉及到時間函數得部分,這里給出資料。// (主要我并沒有深入了解這些東西 int main(){time_t lt;// 定義一個時間變量 lt = time(NULL);// 系統(tǒng)時間與日期p

題目 91

題目:時間函數舉例1

#include<cstdio>#include<ctime> // 涉及到時間函數得部分,這里給出資料。// (主要我并沒有深入了解這些東西 int main(){ time_t lt;// 定義一個時間變量 lt = time(NULL);// 系統(tǒng)時間與日期 printf(ctime(<));// 英文得時間格式 printf(asctime(localtime(<)));// printf(asctime(gmtime(<))); }// asctime() : https://特別runoob/cprogramming/c-function-asctime.html// ctime(): https://特別runoob/cprogramming/c-function-ctime.html// localtime(): https://特別runoob/cprogramming/c-function-localtime.html // gmtime(): https://特別runoob/cprogramming/c-function-gmtime.html 題目 92

題目:時間函數舉例2

#include<cstdio>#include<ctime>#define R register// 計算程序運行時間,之前提到過得 int main(){ // 這里與之前得不同,這里是通過本地時間計算得運行時間 time_t start_time,end_time; start_time = time(NULL); for(R int i = 1;i <= 3000;i++) printf("\1\1\1\1\1\1\1\1\1\1\n"); // \1 為轉義字符 end_time = time(NULL); printf("\1: The different is %6.3f\n",difftime(end_time,start_time)); // difftime返回得是 結束時間與開始時間相差得秒數 // 注意參數順序是結束時間,開始時間 }題目 93

題目:時間函數舉例3

#include<cstdio>#include<ctime>#define R register// 同樣是計算程序運行時間 // clock() : https://特別runoob/cprogramming/c-function-clock.html int main(){ clock_t start_time,end_time; start_time = clock(); for(R int i = 1;i <= 10000;i++) printf("\1\1\1\1\1\1\1\1\1\1\n"); end_time = clock(); printf("\1: The different is %6.3lf\n",(double)(end_time - start_time) / CLOCKS_PER_SEC);}題目 94

題目:時間函數舉例4(一個猜數游戲,判斷一個人得反應快慢)。

#include<cstdio>#include<ctime>#include<cstdlib>#define R registerint x;int main(){ clock_t start_time,end_time; srand(time(NULL)); printf("now you need to guess this number\n"); int ans = rand()%100,cnt = 1; start_time = clock(); scanf("%d",&x); while(x != ans) { if(x > ans) printf("more smaller please\n"); if(x < ans) printf("more bigger please\n"); scanf("%d",&x); cnt++; } end_time = clock(); printf("You only guessed %d times!\n",cnt); printf("And you used %6.3lf s",(double)(end_time - start_time) / CLOCKS_PER_SEC);}題目 95

題目:家庭財務管理小程序

/govmoney management systemgov/ #include <cstdio> #include <dos.h>// 這里得代碼是網上流傳得未解決得代碼// 代碼太抽象了,這里調整了一下排版,由于不清楚具體操作是做什嗎,又懶的分析,這個代碼并沒有完善,還是網絡上得那個帶有bug得代碼// 如果有人想修復這個代碼得話,專業(yè)喊上我一起(- -官網抽不出大把得時間進行完善分析 int main() { FILE govfp; struct date d; float sum,chm = 0.0; int len,i,j=0; int c; char ch[4]="",ch1[16]="",chtime[12]="",chshop[16],chmoney[8]; pp: clrscr(); sum = 0.0; gotoxy(1,1);printf("|---------------------------------------------------------------------------|"); gotoxy(1,2);printf("| money management system(C1.0) 2000.03 |"); gotoxy(1,3);printf("|---------------------------------------------------------------------------|"); gotoxy(1,4);printf("| -- money records -- | -- today cost list -- |"); gotoxy(1,5);printf("| ------------------------ |-------------------------------------|"); gotoxy(1,6);printf("| date: -------------- | |"); gotoxy(1,7);printf("| | | | |"); gotoxy(1,8);printf("| -------------- | |"); gotoxy(1,9);printf("| thgs: ------------------ | |"); gotoxy(1,10);printf("| | | | |"); gotoxy(1,11);printf("| ------------------ | |"); gotoxy(1,12);printf("| cost: ---------- | |"); gotoxy(1,13);printf("| | | | |"); gotoxy(1,14);printf("| ---------- | |"); gotoxy(1,15);printf("| | |"); gotoxy(1,16);printf("| | |"); gotoxy(1,17);printf("| | |"); gotoxy(1,18);printf("| | |"); gotoxy(1,19);printf("| | |"); gotoxy(1,20);printf("| | |"); gotoxy(1,21);printf("| | |"); gotoxy(1,22);printf("| | |"); gotoxy(1,23);printf("|---------------------------------------------------------------------------|"); i = 0; getdate(&d); sprintf(chtime,"%4d.%02d.%02d",d.da_year,d.da_mon,d.da_day); 52 for(;;) { gotoxy(3,24);printf(" Tab __browse cost list Esc __quit"); gotoxy(13,10);printf(" "); gotoxy(13,13);printf(" "); gotoxy(13,7);printf("%s",chtime); j = 18; ch[0]=getch(); if(ch[0]==27) break; strcpy(chshop,""); strcpy(chmoney,""); if(ch[0]==9) { mm:i=0; fp=fopen("home.dat","r+"); gotoxy(3,24);printf(" "); gotoxy(6,4);printf(" list records "); gotoxy(1,5);printf("|-------------------------------------|"); gotoxy(41,4);printf(" "); gotoxy(41,5);printf(" |"); while(fscanf(fp,"%10s%14s%f\n",chtime,chshop,&chm)!=EOF) { if(i==36) { getch(); i = 0; } if ( (i % 36) < 17) { gotoxy(4,6+i); printf(" "); gotoxy(4,6+i); } else if( (i % 36) >16) { gotoxy(41,4+i-17); printf(" "); gotoxy(42,4+i-17); } i++; sum = sum + chm; printf("%10s %-14s %6.1f\n",chtime,chshop,chm); } gotoxy(1,23);printf("|---------------------------------------------------------------------------|"); gotoxy(1,24);printf("| |"); gotoxy(1,25);printf("|---------------------------------------------------------------------------|"); gotoxy(10,24);printf("total is %8.1f#34;,sum); fclose(fp); gotoxy(49,24);printf("press any key to.....");getch();goto pp; } else { while(ch[0] != '\r') { if(j < 10) { strncat(chtime,ch,1); j++; } if(ch[0] == 8) { len=strlen(chtime)-1; if(j > 15){ len = len+1; j = 11; } strcpy(ch1,""); j = j - 2; strncat(ch1,chtime,len); strcpy(chtime,""); strncat(chtime,ch1,len-1); gotoxy(13,7);printf(" "); } gotoxy(13,7);printf("%s",chtime);ch[0]=getch(); if(ch[0]==9) goto mm; if(ch[0]==27) exit(1); } gotoxy(3,24);printf(" "); gotoxy(13,10); j = 0; ch[0]=getch(); while(ch[0] != '\r') { if (j < 14) { strncat(chshop,ch,1); j++; } if(ch[0] == 8) { len=strlen(chshop)-1; strcpy(ch1,""); j = j-2; strncat(ch1,chshop,len); strcpy(chshop,""); strncat(chshop,ch1,len-1); gotoxy(13,10);printf(" "); } gotoxy(13,10);printf("%s",chshop); ch[0]=getch(); } gotoxy(13,13); j = 0; ch[0]=getch(); while(ch[0] != '\r'){ if (j<6) { strncat(chmoney,ch,1); j++; } if(ch[0]==8) { len=strlen(chmoney)-1; strcpy(ch1,""); j=j-2; strncat(ch1,chmoney,len); strcpy(chmoney,""); strncat(chmoney,ch1,len-1); gotoxy(13,13);printf(" ");} gotoxy(13,13);printf("%s",chmoney); ch[0]=getch(); } if((strlen(chshop)==0)||(strlen(chmoney)==0)) continue; // 這下面得if不知道應該配上哪一個,未作改動 if((fp=fopen("home.dat","a+"))!=NULL); fprintf(fp,"%10s%14s%6s",chtime,chshop,chmoney); fputc('\n',fp); fclose(fp); i++; gotoxy(41,5+i); printf("%10s %-14s %-6s",chtime,chshop,chmoney); } }}

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

Copyright?2015-2025 粵公網安備 44030702000869號

粵ICP備16078936號

微信

關注
微信

微信二維碼

WAP二維碼

客服

聯系
客服

聯系客服:

24在線QQ: 770665880

客服電話: 020-82301567

E_mail郵箱: weilaitui@qq.com

微信公眾號: weishitui

韓瑞 小英 張澤

工作時間:

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

反饋

用戶
反饋