Ideas beyond my skill level

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2007
Posts: 5
Reputation: ebmusicman is an unknown quantity at this point 
Solved Threads: 0
ebmusicman ebmusicman is offline Offline
Newbie Poster

Ideas beyond my skill level

 
0
  #1
May 8th, 2007
I have many of them At this point I'm looking for help with a specific idea I know is possible, I just have no idea how to pull it off

first some code:

  1.  
  2. cout << "Would you like to continue? (Y/N);
  3. method1();
  4.  
  1. while(someSentinal)
  2. {
  3. //Do stuff
  4. method2();
  5. //Do more stuff
  6. }
Now let's define what I want from the methods:

method1 - A simple method that accepts one character, as soon as it is hit, without waiting for a newline (or "return") and lets me send it to a char variable to check with, for instance, an if statement.

method2 - A method that checks for a character and allows it to be returned and acted upon in the Do more stuff section. If nothing is there it does different stuff in the do more stuff. Possibly used in a game situation for a real time combat system to check for user input and then go on to calculate some computer player actions.

I'm not too sure if I explained what I want adequately. It makes perfect sense in my head, and I'm sure these methods exist in standard libraries somewhere, I just don't know where.

Thanks for any time you may waste looking at this
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,630
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 718
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Ideas beyond my skill level

 
0
  #2
May 8th, 2007
It sounds like you want the equivalent of getch and kbhit. Search for those two on these forums and you'll find sample code for those functions and alternatives. Keep in mind that what you want to do isn't portable.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 5
Reputation: ebmusicman is an unknown quantity at this point 
Solved Threads: 0
ebmusicman ebmusicman is offline Offline
Newbie Poster

Re: Ideas beyond my skill level

 
0
  #3
May 8th, 2007
When you say portable I assume you mean compiling with g++ pretty much guarantees non-compiling with, for instance, Visual C++ ?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,630
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 718
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Ideas beyond my skill level

 
0
  #4
May 8th, 2007
>When you say portable I assume you mean compiling with g++ pretty
>much guarantees non-compiling with, for instance, Visual C++ ?
Something like that.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 5
Reputation: ebmusicman is an unknown quantity at this point 
Solved Threads: 0
ebmusicman ebmusicman is offline Offline
Newbie Poster

Re: Ideas beyond my skill level

 
0
  #5
May 8th, 2007
Oki doke, I'll bang my head against it for a bit more and complain if I get a headache Thanks for the help!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC