Find Jobs
Hire Freelancers

Alarm Clock

$15-20 USD

进行中
已发布大约 21 年前

$15-20 USD

货到付款
Objectives: Practice implementation of C++ code using inheritance. Problem Description: This program should be implemented using Microsoft Visual C++ 6.0. (1) Develop a Clock class (2) Develop an AlarmClock class (3) Develop a driver program for the AlarmClock class Requirements: (1) Clock class This class displays the computer operating system time using the 24-hour format, e.g., 13:05:11. The display refreshes approximately every second. You may use the Sleep(int msec) function whose prototype is in to pause for one second before refreshing. (2) AlarmClock class This class inherits from the Clock class. The additional data member is the time at which the alarm message ("Time is up") will be displayed for five times. The internal presentation of the time in the class is the number of seconds since midnight of 1/1/1970. The AlarmClock continues to display the system time after the alarm message is displayed. (3) Driver program The driver program allows the user to specify the arguments for the alarm clock. It will utilize the AlarmClock class to demonstrate the functionality of the class. The command line for executing the program is something like this: alarmclock 15:20:30 (This will set the alarm off at 15:20:30.) (4) Adding any utility methods is your decision. Deliverables: (1) A floppy disk that contains .dsw, .dsp, .h and .cpp files; (2) Hardcopies of the .h, .cpp files and the output; (3) An envelope to hold both the floppy disk and the hardcopies. ## Deliverables References: (1) Sample code for getting command line arguments: int main(int argc, char *argv[]) { cout << "you have entered " << argc << " arguments" << endl; int i; for (i = 0; i < argc; i++) { cout << "argv[" << i << "] is: " << argv[i] << endl; } return 0; } Note that argv[i] is a char *, which points to a NULL-terminated string. If you need to convert such a string into a number, use the function atoi(). See Textbook p.874 for details. (2) About system time System time as the number of seconds since the midnight of 1/1/1970 can be obtained using the time() function. See the example from MSDN below: /* ASCTIME.C: This program places the system time * in the long integer aclock, translates it into the * structure newtime and then converts it to string * form for output, using the asctime function. */ #include #include struct tm *newtime; time_t aclock; void main( void ) { time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ /* tm form */ /* Print local time as a string */ printf( "The current date and time are: %s", asctime( newtime ) ); } Output The current date and time are: Sun May 01 20:27:01 1994 (3) Use the asctime() function to extract the time in the hh:mm:ss format for display. ## Platform any OPERATING SYSTEM, MS WINDOWS 98 OR NEWER. PROGRAM MUST BE WRITTEN BY USING MICROSOFT VISUAL C++ 6.0.
项目 ID: 2917471

关于此项目

2提案
远程项目
活跃21 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
See private message.
$7 USD 在14天之内
5.0 (17条评论)
3.6
3.6
2威客以平均价$10 USD来参与此工作竞价
用户头像
See private message.
$12.75 USD 在14天之内
4.9 (92条评论)
6.0
6.0

关于客户

UNITED STATES的国旗
United States
5.0
2
会员自3月 19, 2003起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。