![]() |
| ||
| Replacing system("pause"); with a function I hear alot of people saying not use: system("pause");I think you get what I mean, so I'm trying to make functions that will replace all of these, and for my first installment I'm going to show you how to replace system("pause");. Here is what I have. #include <iostream> There are probably a million things wrong with this right now and I plan on making a better function that will allow you to set the time of the pause and wether or not the user even needs to input a key to continue. Thanks for any constructive critisism!! ^_^ |
| ||
| Re: Replacing system("pause"); with a function >Thanks for any constructive critisism!! PrsAnyKey2Cont is a very awkward name. |
| ||
| Re: Replacing system("pause"); with a function Yeah, I know, but I couldn't think of anything short and descriptive. XD Do you have any seggestions for a better name? |
| ||
| Re: Replacing system("pause"); with a function >Do you have any seggestions for a better name? At the risk of borrowing an existing name, "pause" is short and sweet. Throwing it in a "console" namespace is descriptive, and I can type and read console::pause so much faster than PrsAnyKey2Cont. :) |
| ||
| Re: Replacing system("pause"); with a function Excuse me for sounding like a total noob here for a second, but what is a "console namespace". To tell you the truth I've been writing: using namespace std;at the beginning of all of my programs for almost 2 years and I've never learned what it meant. Sorry. =[ |
| ||
| Re: Replacing system("pause"); with a function I BELIEVE that a namespace is just something used to give context to where something should be used. Also, it helps to avoid conflicting names. |
| ||
| Re: Replacing system("pause"); with a function So, what does it mean to say std::pause? |
| ||
| Re: Replacing system("pause"); with a function Is there a pause in std? do you mean std::system("pause") ? Well anyways, since 'pause' is/would be in namespace std, you must first 'access' the std namespace. Think of it as a box where you put things to keep them either organized, or from getting jumbled with other things. You can't simply remove something from the box without first opening the box... (Said box has a lid...) |
| ||
| Re: Replacing system("pause"); with a function Yeah I just forgot to put using namespace std;, which would open the box, right? |
| ||
| Re: Replacing system("pause"); with a function More like dumping the box all over the floor... Because once the box is opened (using namespace std; ) you no longer have to open it each time you want something from it (std:wantedObject) |
| All times are GMT -4. The time now is 11:28 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC