下列程序读入时间数值,将其加1秒后输出,时间格式为:hh:m:ss,即小时:分钟:秒,当小时等于24小时,置为0。#include[br][/br]struct{[br][/br]int hour,minute,second;}time;[br][/br]int main(void){scanf("%d:%d:%d",[input=type:blank,size:4][/input])[br][/br]time.second++;[br][/br]if([input=type:blank,size:4][/input]==60){[br][/br][input=type:blank,size:4][/input];time.second =0;[br][/br]if(time.minute==60){[br][/br]time.hour++;[br][/br]time.minute =0;[br][/br]if([input=type:blank,size:4][/input])time.hour =0;}}printf("d:%d:%d \n",time.hour,time.minute,time.second )[br][/br]return 0;}[br][/br]
举一反三
- 下列 程序读入时间将其假1秒后输出,格式为hh:mm:ss,当小时等于24小时置为0#include <stdio.h>struct { int hour ,minute,second; } time ;void main(void){ scanf("%d:%d:%d",[input=type:blank,size:4][/input] ); time.second++; if( [input=type:blank,size:4][/input]==60) { [input=type:blank,size:4][/input] time.second=0; if( time.minute==60) { time.hour++; time.minute=0; if([input=type:blank,size:4][/input]) time.hour=0; } }
- 下面程序用于计算f,n)=1+2++n,其中power(m,n)求m”。请填写程序中相应语句。[br][/br]include <stdio.h>[br][/br]int power(int m,int n){[br][/br]int i;[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i+)[br][/br][input=type:blank,size:4][/input];return p;}int f(int k,int n)[br][/br]{[br][/br]int i[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i++)[br][/br][input=type:blank,size:4][/input];return s;}int main(void)[br][/br]{intk,n;[br][/br]scanf"%d%d",&k,&n);[br][/br]printf“f(%d,%d)-%ld”,k,n,fk,n);[br][/br]return 0;[br][/br]}[br][/br]
- 下列程序读入时间数值,将其加1秒后输出,时间格式为:hh: mm: ss,即“小时:分钟:秒”,当小时等于24小时,置为0。 #include <stdio.h> struct { int hour, minute, second; } time; int main(void) { scanf("%d:%d:%d",___________); time.second++; if(___(2)_______ == 60) { ____(3)__________ ; time.second = 0; if(time.minute == 60) { time.hour++; time.minute = 0; if(_____(4)_________) time.hour = 0; } } printf ("%d:%d:%d ", time.hour, time.minute, time.second ); return 0; }
- 下列程序段A与B功能等价,请填写程序段B中相应语句。程序段A:[br][/br]int f(int n[br][/br]{if(n<=1)[br][/br]return n;[br][/br]else[br][/br]return f(n-1)+f(n-2),[br][/br]}[br][/br]程序B:[br][/br]int f(int n){[input=type:blank,size:4][/input];t0=0,t1=1,t=n;[br][/br]while ([input=type:blank,size:4][/input])[br][/br]t=[input=type:blank,size:4][/input];t0=t1;[br][/br]t1 =t;[br][/br]n--,[br][/br]}[br][/br]return[input=type:blank,size:4][/input]}[br][/br]
- 细胞的死亡一般定义为[input=type:blank,size:4][/input]通常用[br][/br][br][/br][input=type:blank,size:4][/input]鉴别细胞的死活,活[br][/br][br][/br]细胞容易被[input=type:blank,size:4][/input][br][/br]染色,死细胞容易被[input=type:blank,size:4][/input][br][/br]染色。