Anyone check whats wrong with my code?

This is a discussion on Anyone check whats wrong with my code? within the C++ Programming forums, part of the General Programming Boards category; HI. I am still practising basics of C++ by making loads of mini programs. I made one which converts seconds ...

  1. #1
    Registered User jr2007's Avatar
    Join Date
    Oct 2003
    Posts
    16

    Question Anyone check whats wrong with my code?

    HI.

    I am still practising basics of C++ by making loads of mini programs.

    I made one which converts seconds into hours:minutes:seconds

    In my other programs, i use
    Code:
     system("PAUSE");
    to have a 'press any key to continue...' message as a pause. But with this code it doesn't work. Can anyone help??

    I attached the relevant .cpp file.
    Attached Files Attached Files
    JR Industries
    www.neono.co.nr

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    Works fine for me. How exactly does it "not work"?

    gg

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    What system are you compiling it on?
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    87
    One problem i found was this:

    Code:
    #include <iostream.h>
    using namespace std;
    the old .h version doesn't use namespaces, atleast not in MSVC you might wanna try changing this to the new standard include file:

    Code:
    #include <iostream>
    using namespace std;
    if that still don't fix it for you, you might wanna try writing your own little function something alike this:

    Code:
    void Pause()
    {
        cout << "Press enter to continue . . .";
        cin.ignore(255, '\n');
    	cin.get();
    }
    remember that a function like system("PAUSE"); is very system/compiler specific, posting the compiler and OS ur using would be useful

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    To use
    Code:
    system("somecommandhere");
    you must include cstdlib.

  6. #6
    Registered User jr2007's Avatar
    Join Date
    Oct 2003
    Posts
    16
    I use Bloodshed Dev C++ and WinXP Pro.
    JR Industries
    www.neono.co.nr

  7. #7
    Registered User jr2007's Avatar
    Join Date
    Oct 2003
    Posts
    16
    It works now! Thanks everyone.

    Here it is.
    Attached Files Attached Files
    JR Industries
    www.neono.co.nr

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's wrong with this code?
    By Finchie_88 in forum Networking/Device Communication
    Replies: 10
    Last Post: 05-27-2005, 10:46 AM
  2. What's wrong with my Win32 Wrapper code?
    By miica in forum Windows Programming
    Replies: 9
    Last Post: 02-22-2005, 08:55 PM
  3. What's wrong with this code?
    By Tride in forum C Programming
    Replies: 5
    Last Post: 05-26-2003, 01:40 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. what's wrong with this qsort code?
    By Sargnagel in forum C Programming
    Replies: 2
    Last Post: 01-12-2003, 06:58 AM

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