Hey guys, I'm starting to learn C++ using "C++ Programming for the Absolute Beginner" (not pirated, I swear >.>) but I don't know anybody that can code in C or C++ so I'm wondering if anyone here would like to help me learn (by adding me on msn and answering the occasional quick question or giving me a few tips). I can't post emails yet but I will when I have a few more posts.
Also, I'd appreciate any tips on learning a new programming language that you'd like to give to make the process a little easier.
The questions will be like "How do I use cin to stop my program exiting automatically after it finishes doing its thing not allowing me to view my work?" (I'd appreciate an answer to that one asap actually xP).
Any help is appreciated and I'm glad to be a part of your wonderful community.
C++ newbie.
Started by Rockoff, Nov 11 2009 09:39 PM
7 replies to this topic
#1
Posted 11 November 2009 - 09:39 PM
|
|
|
#2
Posted 12 November 2009 - 08:48 AM
Just ask your questions here, and we'll attempt to answer them.
At the end of main(), before your return statement, just add "cin>>myint;"
At the end of main(), before your return statement, just add "cin>>myint;"
#3
Posted 12 November 2009 - 12:45 PM
cin.get() might be better...
#4
Posted 12 November 2009 - 02:50 PM
The best way to learn a programming language (just like most other things) is practice. You have to make sure that you are constantly programming new things. You also have the be determined enough to be able to keep going even when your code doesn't compile.
A fun way to get fairly good at programming is working on open source projects. It is only fun if you enjoy the project. You can start small by finding bugs and trying to figure out what can be done to fix. Eventually you will actual submit your own patches.
If you enjoy programming and know a bit but want to learn. Myself and a buddy work on an open source keylogger. It's on SourceForge under "myHook". Pretty good code base so far.
Good luck!
A fun way to get fairly good at programming is working on open source projects. It is only fun if you enjoy the project. You can start small by finding bugs and trying to figure out what can be done to fix. Eventually you will actual submit your own patches.
If you enjoy programming and know a bit but want to learn. Myself and a buddy work on an open source keylogger. It's on SourceForge under "myHook". Pretty good code base so far.
Good luck!
http://logickills.org
Science - Math - Hacking - Tech
Science - Math - Hacking - Tech
#5
Posted 12 November 2009 - 06:55 PM
I am kind of new to c++. I am curious other then system pause because that obviously isnt the best method of stopping the console program from what I hear. So how does the other methods work because I have yet to figure them out. Running the program within the ide i use keeps it open but outside it closes too fast.
#6
Posted 14 November 2009 - 09:14 AM
The goal is to ask for input to keep it from closing. The best suggestion, for my money, is to simply launch the program from the command line, not the IDE. That way, you can see the output after the program closes.
#7
Posted 14 November 2009 - 11:13 AM
If you're using VC++, try this.
At the end of your program. This will cause it to stop and wait for the <enter> key before continuing. Checking for _DEBUG means it will only be compiled in when you run it via F5.
#if defined(_DEBUG)
std::cin.get();
#endif
At the end of your program. This will cause it to stop and wait for the <enter> key before continuing. Checking for _DEBUG means it will only be compiled in when you run it via F5.
#8
Posted 14 November 2009 - 01:24 PM
Well if i just put cin.get() or cin.ignore twice at the end of my program it stops it. Was playing with one of my programs last night and figured it out. The ide i use is codeblocks mainly.


Sign In
Create Account

Back to top









