Thread: Please help with program

  1. #1
    Registered User nevermind's Avatar
    Join Date
    Oct 2002

    Please help with program

    A twelve hour clock; stores hours, minutes, seconds, AM or PM. Intitial hours, mins, secs are 0 by default. User is requested for the entries. Then the clock is advanced by seconds one by one.

    The user is given a statement to stop the clock such as "press a key to stop clock", then once the user has hit a key, the clock stops 'ticking' and is displayed to the user with the delay added.

    I was hoping that anyone could provide me with a *simple* solution (i.e. only with classes, concrete data types and basic c++) , I posted mine earlier but it was'nt that good. Any help will be appreciated.


  2. #2
    just one class is needed...

    class clock{
    int hrs;
    int mins;
    int secs;

    bool DN = 0; // Day or Night - 0 for day, 1 night AM/PM

    function print(){
    //where you cout>> statement

    //invoke the class

    //Create loop to continuosly update and print out time

    Obviously this is just psuedo code but should help if you're having trouble with design.
    My Avatar says: "Stay in School"

    Rocco is the Boy!

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Do mean something like a timer?!

  4. #4
    Registered User nevermind's Avatar
    Join Date
    Oct 2002


    Thanks for the help ... I know how to make my original code even cleaner than before. Woohoo! thanks everyone.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM