要求: 1.能够人工及自动设置时间,并能显示人工设置时间及返回系统当前时间。
2.程序结构采用多文档结构,即类的定义与声明分开。
希望能讲清楚。谢谢。
用C++设计一个Clock时钟类程序
答案:3 悬赏:60 手机版
解决时间 2021-02-16 18:18
- 提问者网友:富士山上尢
- 2021-02-15 22:35
最佳答案
- 五星知识达人网友:渡鹤影
- 2021-02-15 23:23
#include ?iostream.h?
#include ?string.h?
#include ?stdlib.h?
struct movies_t {
char title [50];
int year;
}mine, yours;
void printmovie (movies_t movie);
int main () {
char buffer [50];
strcpy (mine.title, "2001 A Space Odyssey");
mine.year = 1968;
cout << "Enter title: ";
cin.getline (yours.title,50);
cout << "Enter year: ";
cin.getline (buffer,50);
yours.year = atoi (buffer);
cout << "My favourite movie is:\n ";
printmovie (mine);
cout << "And yours:\n";
printmovie (yours);
return 0;
}
#include ?string.h?
#include ?stdlib.h?
struct movies_t {
char title [50];
int year;
}mine, yours;
void printmovie (movies_t movie);
int main () {
char buffer [50];
strcpy (mine.title, "2001 A Space Odyssey");
mine.year = 1968;
cout << "Enter title: ";
cin.getline (yours.title,50);
cout << "Enter year: ";
cin.getline (buffer,50);
yours.year = atoi (buffer);
cout << "My favourite movie is:\n ";
printmovie (mine);
cout << "And yours:\n";
printmovie (yours);
return 0;
}
全部回答
- 1楼网友:毛毛
- 2021-02-16 01:15
内容无所谓,,
- 2楼网友:想偏头吻你
- 2021-02-16 00:16
我来 see my name ,find me
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯