As the thread name says.
How would I lock all keys without the numbers 0-9?
Thanks
As the thread name says.
How would I lock all keys without the numbers 0-9?
Thanks
howabout, instead of locking everything. just create functionality for 1-9? and nothing else?
Sometimes I forget what I am doing when I enter a room, actually, quite often.
Lock? You mean, not recieve them?
Using getch(), you could do something like this:
but getch() isn't standard.Code:int c; for(;;) { c = getch(); if(isdigit(c)) { std::cout << c; // process number here } }
You could just use getline() and ignore anything that isn't isdigit().
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Try to imagine someone asking which OS/Compiler.
Nevermind - Which OS/Compiler?
What constitutes "locked" anyway when you have certain keys like alt-tab in windows for choosing other programs - do you want to lock those as well?
Hmm... Yes really. Its a password as you probably understood. I dont want people to be able to just "go out" of it.What constitutes "locked" anyway when you have certain keys like alt-tab in windows for choosing other programs - do you want to lock those as well?
Windows XPNevermind - Which OS/Compiler?
Dev-C++
> I dont want people to be able to just "go out" of it.
Be careful here - if you go round just locking people out of their machines your software will be regarded as malware. Besides, if they alt-tab, it's just sending focus to another program and yours goes to the background - why would that matter to you.
Nobody elses password input locks the whole machine in the way you seem to be wanting to.
Seems to me all you're really after is all input, and then you apply isdigit() to each input character.