Please help with program

This is a discussion on Please help with program within the C++ Programming forums, part of the General Programming Boards category; A twelve hour clock; stores hours, minutes, seconds, AM or PM. Intitial hours, mins, secs are 0 by default. User ...

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

    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.


    Thanks!

  2. #2
    UNBANNED OneStiffRod's Avatar
    Join Date
    Jan 2002
    Posts
    669
    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
    }
    };

    Main(){
    //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!
    "SHUT YOUR LIPS..."

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

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

    thanks

    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, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21