I to be doing an regime where you have to find the hypotenuse the a best triangle. Whatever works fine. The inquiry I have is "Press get in To Continue." as soon as this mister up, I can still press any an essential besides Enter and it will continue to the following problem, i m sorry I execute not want. I desire them to press the "ENTER" key. Is their a way to execute that? Also, if friend look at my program, ns am making use of getch() 4 times. Is your a means to limit the to only using that once?Thanks,- Brad

#include #include #include making use of namespace std;int main(){ twin x, y; cout > x; cout > y; dual hypotenuse, V; hypotenuse = sqrt(pow(x,2) + pow(y,2)); cout > radius; cout > radius; cout > height; cout > peak; cout > degree; cout

*

#2janotte


code > sword
*

Replace your calls to the non-standard "getch()" v calls come the traditional "getchar()".Does it work as you want now?

*
janotte, top top 14 January 2011 - 04:16 PM, said:


Replace your calls to the non-standard "getch()" through calls come the conventional "getchar()".Does it work-related as you want now?
It still does the exact same thing. Once I run the program, and also it offer the out come of the hypotenuse and tells me "Press go into To Continue," ns pressed the letter n top top the keyboard and it continued. I am do the efforts to make it wherein you have to press the "Enter" crucial to continue, and also if girlfriend press any type of other vital besides "Enter" it will certainly not continue.

You are watching: C++ press enter to continue


#4ishkabible


you will want to usage your OS's an essential functions. Look's like your making use of Turbo C++ so GetAsyncKeyState() must work.
If all you want is the Enter crucial then you need to write her own duty that ignores all various other keys. Because that example, this supplies non-standard conio.h only due to the fact that that's what friend tried to use in your initial post. Us don't introduce it due to the fact that not every compilers assistance it.

#include #include #include void pause(const char* message) // clear keyboard buffer int c; while( _kbhit() ) _getch(); std::cout ::max(), '\n'); std::cin.get();return 0;
you will want to use your OS's an essential functions. Look's choose your utilizing Turbo C++ so GetAsyncKeyState() have to work.
I am utilizing De++ 4.9.92 Beta. Not sure if that Turbo. I never even heard of the keystat() role but i will try to view if ns can obtain that come work.
If all you want is the Enter key then you have to write your own role that ignores all various other keys. Because that example, this provides non-standard conio.h only since that's what you tried to usage in your original post. Us don't introduce it because not all compilers assistance it.

#include #include #include void pause(const char* message) // clear key-board buffer int c; while( _kbhit() ) _getch(); std::cout ::max(), '\n'); std::cin.get();return 0;
reason for the conio.h was since so I have the right to use the getchar() or getch() because I was gaining an error before.

See more: Lehetőség Vitorla Kövület What Have You Brought Upon This Cursed Land


if your making use of window's then GetAsyncKeyState() need to work. You will require to include windows.h. Why space you utilizing conio.h? it's no stranded and no one offers it the i know of. Don't usage conio.h ever. If you have an error that if fixes, solve it another way becuase it's no right. If you have actually the error again write-up it and your code and we can help

This short article has been edited by ishkabible: 14 January 2011 - 05:52 PM


if your making use of window's then GetAsyncKeyState() have to work. Friend will need to include windows.h. Why are you utilizing conio.h? it's no stranded and also no one supplies it that i understand of. Don't usage conio.h ever. If you have an error the if fixes, resolve it another means becuase it's not right. If you have actually the error again write-up it and your code and we deserve to help
so what header permits you to usage getch or getchar since without conio.h you can not usage getch or getchar. Because you space saying that is not correct to use conio.h, what can I usage that is comparable to getch or getchar wherein I carry out not need conio.h? (I am glad you men are informing me this, ns wont do this failure again.)
Thank you.....now ns just have to number out how to stop it at "Press get in To Continue" with out adding part 2 to it.
The answers here will get you the systems you are looking forhttp://www.dreaminco...on-window-open/