is system("PAUSE") required in every program?

This is a discussion on is system("PAUSE") required in every program? within the C++ Programming forums, part of the General Programming Boards category; No, they don't. You can make them do unexpected things, but you cannot breach security. You cannot use them to ...

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    No, they don't. You can make them do unexpected things, but you cannot breach security. You cannot use them to gain permissions you don't already have. (You might, under very special circumstances, be able to trick someone into executing your code.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Registered User
    Join Date
    Aug 2007
    Location
    MD, USA
    Posts
    71
    system("pause"); causes my win '98 laptop pain!
    Really, it overheats if I leave it for a few minutes.
    That indicates to me that it's asking the cpu to do an endless loop or something. (way to go Bill guys...)
    I just use a blocking function loop like while(getchar() != '\n'); in C or while(cin.get() != '\n'); in C++.

    And re: pre- and post-increment / decrement :
    Code:
      cout << endl << "Hit enter to continue";
      while(cin.get() != '\n');
      int x = 10;
      cout <<  x++  << endl;  // prints 10  increments after usage so...
      cout <<    x  << endl;  // prints 11  the change shows up next time x is used
      cout <<  --x  << endl;  // prints 10  decrements before usage so shows up immediately
      cout <<  x--  << endl;  // prints 10  after...
      cout <<    x  << endl;  // prints 9   get the idea?
    Last edited by HowardL; 09-02-2008 at 05:01 PM.

  3. #18
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by HowardL View Post
    system("pause"); causes my win '98 laptop pain!
    Really, it overheats if I leave it for a few minutes.
    That indicates to me that it's asking the cpu to do an endless loop or something. (way to go Bill guys...)
    Are you serious??
    If you look at the process in Task Manager, does it show any CPU activity?

    I don't have a Win98 system to try, but when I run PAUSE on Vista I see 0% CPU.

  4. #19
    Registered User
    Join Date
    Aug 2007
    Location
    MD, USA
    Posts
    71
    Yes, Really. Running this alone causes fan to come on after about 10 minutes:
    Code:
    #include <iostream>
    #include <cstdlib>
    using namespace std;
    int main(void)
    {
      cout << "Hit the <any> key to continue" ;
      system("pause");
      return 0;
    }
    Sorry but I don't know of a way to view cpu usage in 98.
    Looks like those tools become available for win2000 and up.
    Last edited by HowardL; 09-03-2008 at 12:32 AM.

  5. #20
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I'm pretty sure Win98 had a task manager with a process tab and CPU usage.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #21
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I think the bigger problem is that DOS-boxes in Win98 do not end up in Windows IDLE in the same way that a Win NT onwards DOS box does. DOS boxes in Win98 have completely different underlaying software functions, so it may well be that "PAUSE" doesn't stop the CPU from running at 100%.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #22
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,027
    The examiner is quite obviously an idiot, but there's not much we can do.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie needs help..
    By xpress urself in forum C++ Programming
    Replies: 3
    Last Post: 07-26-2007, 08:22 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 08:51 AM
  5. 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