File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beginner problem

 
John Call
Greenhorn
Posts: 20
Java MyEclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 423
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic