GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Sep-2007, 10:45
doom1992 doom1992 is offline
Junior Member
 
Join Date: Jul 2007
Posts: 98
doom1992 is on a distinguished road

Timer


hi there everyone, i want to put a timer of 30 second between my 2 questions in the program, once the timer has finnished and the user has not typed in the first question it will move to the next question. here is my code.

CPP / C++ / C Code:
#include <iostream>

int main () {
    std::string firstname;
    std::string lastname;
    
    std::cout <<"What is you first name: ";
    std::cin >> firstname;
    
    std::cout <<"What is you last name: ";
    std::cin >> lastname;
    
    std::cout <<"Press Enter to exit";
    std::cin.ignore(100, '\n');
    std::cin.get();
    return 0;
}

PLEASE DONT GIVE ME A SMART COMMENT LIKE, GOOGLE IS YOUR FRIEND, WHY DO YOU WANT TO KNOW THIS, ETC.
  #2  
Old 09-Sep-2007, 11:14
Kimmo Kimmo is offline
Member
 
Join Date: Mar 2007
Location: Finland
Posts: 229
Kimmo has a spectacular aura aboutKimmo has a spectacular aura about

Re: Timer


Quote:
Originally Posted by doom1992
PLEASE DONT GIVE ME A SMART COMMENT LIKE, GOOGLE IS YOUR FRIEND, WHY DO YOU WANT TO KNOW THIS, ETC.
Well how about this:

Please don't include this notice in your every thread. Just my opinion. If someone is up for some smart answers, a notice like that just guarantees he's going to give it. (For example, without that notice you wouldn't be reading this now.)
  #3  
Old 09-Sep-2007, 14:34
davis
 
Posts: n/a

Re: Timer


Quote:
Originally Posted by doom1992
hi there everyone, i want to put a timer of 30 second between my 2 questions in the program, once the timer has finnished and the user has not typed in the first question it will move to the next question. here is my code.

CPP / C++ / C Code:
#include <iostream>

int main () {
    std::string firstname;
    std::string lastname;
    
    std::cout <<"What is you first name: ";
    std::cin >> firstname;
    
    std::cout <<"What is you last name: ";
    std::cin >> lastname;
    
    std::cout <<"Press Enter to exit";
    std::cin.ignore(100, '\n');
    std::cin.get();
    return 0;
}

There is no such notion as a "timer" in standard C++. Timers are usually provided via hardware and/or operating system features. In other words, it is platform-specific.


Quote:
Originally Posted by doom1992
PLEASE DONT GIVE ME A SMART COMMENT LIKE, GOOGLE IS YOUR FRIEND, WHY DO YOU WANT TO KNOW THIS, ETC.

QUIT SHOUTING AND ALWAYS TELLING US WHAT YOU DON'T WANT. WE ALREADY KNOW THAT GOOGLE IS NOT YOUR FRIEND.

See: www.boost.org

...which was obtained using Google:

www.google.com


:davis:
  #4  
Old 11-Sep-2007, 10:09
doom1992 doom1992 is offline
Junior Member
 
Join Date: Jul 2007
Posts: 98
doom1992 is on a distinguished road

Re: Timer


kk, kimmo i said no smart answers,

DOH!!!!
  #5  
Old 11-Sep-2007, 10:54
Kimmo Kimmo is offline
Member
 
Join Date: Mar 2007
Location: Finland
Posts: 229
Kimmo has a spectacular aura aboutKimmo has a spectacular aura about

Re: Timer


Quote:
Originally Posted by doom1992
kk, kimmo i said no smart answers,

DOH!!!!
The point, which you are apparently missing, was that if you didn't include those useless notifications in your every thread, people wouldn't be giving you the "smart answers."

Here's some simple psychology:

If someone wants to give smart answers, it gives them a bit of satisfaction to give those smart answers in every thread they can. (Btw, how many people giving smart answers have you seen around here? Excluding me, of course? Generally people here give pretty good answers, they are not 14 anymore.)

Now, if you have a notification like "hey dude, whatever you do, do NOT give me the smart answers or I'll really pity you", what do you think is the effect? The effect in most cases certainly is not the person giving up his smart answers. He's going to give those answers just because he knows you will be pissed. He gets double satisfaction.

And then, after he's given his answers, if you come back to tell him "hey I said no smart answers", he's getting the triple satisfaction for getting you to come back to comment his useless answers.

Sorry for the off-topic, but I really think you should take something like this in consideration when starting up your next thread. Just ask your question and be done with it. If someone gives a smart answer.. So? Who actually cares?

(Just look at this thread. Without the notification Davis would've just said "it depends..." and I wouldn't have said a thing.)
  #6  
Old 11-Sep-2007, 14:09
doom1992 doom1992 is offline
Junior Member
 
Join Date: Jul 2007
Posts: 98
doom1992 is on a distinguished road

Re: Timer


lmao!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  #7  
Old 17-Sep-2007, 12:36
davis
 
Posts: n/a

Re: Timer


Quote:
Originally Posted by doom1992
lmao!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I'm not sure how many exclamation marks are necessary to indicate your point. Are 15 enough or is the absolute minimum 30?

Did you have a chance to see if the boost timer will work for your needs?


:davis:
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Timer in OCX budihartanto MS Visual C++ / MFC Forum 0 11-Jun-2006 21:23
Hardware Interrupt and Timer Interrupt in C++ Electrical C++ Forum 1 28-Mar-2006 14:42
how to create a timer in c++ Radi0ShacK C++ Forum 14 22-Feb-2006 19:21
How do i create a mfc timer teck hui MS Visual C++ / MFC Forum 2 25-Nov-2004 20:59
[class] Timer JdS PHP Code Library 2 29-Apr-2003 12:20

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:09.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.