I'm using Microsoft Visual Studio 2010 and programming in C. The computer is running Windows 7. The program I'm writing will run in a cmd window (C:\Windows\system32\cmd.exe).
The program has a char variable, "foo." What I need the program to do is:
1) set foo to some default value, let's say "D"
2) Prompt the user to enter the value of foo. It should not be necessary for the user to follow the entry with the "Enter" key (e.g., if the user hits only the "a" key, then foo becomes "a"). If the user makes no entry at all for five seconds, keep the default value for foo and go to step 3. If the user enters a character, immediately go to step 3 (i.e., don't wait out the remainder of the five seconds.)
3) report back the value of foo to the user -- printf("Foo is %c\n",foo);
My compiler, MS Visual Studio 2010, will do C++ as well, and I'm aware that C++ is (in theory at least) a superset of C. I only know some C programming, not C++, so if you give me a C++ answer please keep in mind that it will have to work with a program that's otherwise in C.
How do I do this? Thanks!
Copyright © 2024 Q2A.MX - All rights reserved.
Answers & Comments
Verified answer
Before you start doing all that,
make sure to declare new
and used variables correctly.
No. application supervisor replaced into the call of the element to residing house windows that provided the main application launching residing house windows for pre-residing house windows ninety 5 variations of residing house windows. In residing house windows ninety 5 it merged with what replaced into talked approximately as document supervisor and grew to strengthen into residing house windows Explorer (in charge for working the commencing up Menu and document administration, between different issues).