📄 ex11-09.cpp
字号:
//EX11-09.cpp
#include <iostream.h> //cout,cin
#include <conio.h> // getch()
#include <time.h> //time()
#include <dos.h> //date
void main()
{ time_t current_s,birthday_s;
date current,birth;
int mon,day;
current_s = time(NULL);
getdate(¤t); //get current date
cout << "Current date is:";
cout << current.da_year<<' '
<<(int)current.da_mon<<' '
<<(int)current.da_day<<endl;
cout << "Enter year(after 1980),month,day:";
cin >> birth.da_year
>> mon
>> day;
birth.da_mon=char(mon);
birth.da_day=char(day);
setdate(&birth);
birthday_s = time(NULL);
cout << "The seconds from your birth to now are:"
<< (current_s - birthday_s);
setdate(¤t); //set current date back
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -