aspose file tools*
The moose likes C / C++ and the fly likes beginner problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "beginner problem" Watch "beginner problem" New topic
Author

beginner problem

John Call
Greenhorn

Joined: Apr 11, 2011
Posts: 20

Hi i am pretty naive to c++,already knew java.
Please tell me what 's wrong with this simple code.
It's not displaying integer entered by me but return back after entering integer and hitting enter.I am using devc++.
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
Hi friend. so the screen disappears and you can't see the result ...

Solution: use cin.get() twice!



Albatross wrote:You had a '\n' left in your cin's buffer when you called cin.get(), which got the new line and then moved on.
http://www.cplusplus.com/forum/beginner/48152/
Brian Overland
author
Ranch Hand

Joined: Sep 09, 2011
Posts: 36
Hmmmn... the problem here may be that programs in console mode, when spawned from Windows (or Mac operating system or whatever), tend to immediately go away when they are done running. That is why all the examples in my book use system("PAUSE");

However, the use of cin.get() recommended by the other post should work fine, I think.

Hope this helps... best of luck with your programming,

Brian Overland
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beginner problem