![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Quote:
http://www.cplusplus.com/doc/tutorial/index.html is very thorough from the start on up. For a book I recommend "Standard C++ Bible" by Al Stevens and Clayton Walnum. It has a CD-ROM with all the sample code from the book and an integrated compiler, so you can run the code and most importantly experiment with it. That's the way to learn!!! |
|
|
|
|
|
|
#12 |
|
Newbie
Join Date: Feb 2005
Posts: 18
Rep Power: 0
![]() |
http://www.cprogramming.com/ also has some helpful tutorials~
|
|
|
|
|
|
#13 | |||
|
Newbie
|
Quote:
I use that site but wen i compile it and try to run it all it does is cmd opens real fast and closes right away... i tried what they gave me which was this Quote:
Quote:
__________________
Welcome to the real world... |
|||
|
|
|
|
|
#14 |
|
Programming Guru
![]() |
This would be better..
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
cout << "Hello world!" << endl;
// endl = End of line, ends the output line and starts a new one...
cout << "endl put this here... ";
cout << "instead of here.";
getch();
// included by conio.h
// - Waits for keyboard input and the continues...
// - Shows nothing on the screen...
return 0;
}
__________________
Last edited by tempest; Feb 20th, 2005 at 9:37 PM. |
|
|
|
|
|
#15 |
|
Newbie
|
cool htat works too... what does conio.h do?
__________________
Welcome to the real world... |
|
|
|
|
|
#16 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
LOL forget that
just add: int fsd; cin >> fsd; put this at the very end right before return 0; its cuz some compilers just terminate immediately after execution. Yea, I was quite confused too when I switched compilters from the Borland to Visual Studio .Net (I think). I still don't know why though, but you probably have to add a cin or get char/line or whatever to pause.
__________________
... |
|
|
|
|
|
#17 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Stick with cin.get();. cin >> fsd; uses an unneeded variable, and while getch(); works, it may not work on a different compiler.
|
|
|
|
|
|
#18 |
|
Newbie
|
oooh i get it!
__________________
Welcome to the real world... |
|
|
|
|
|
#19 |
|
Programming Guru
![]() |
getch() is the best option on a windows compiler. However if you move to linux you have to look to cin alternatives.
As for not working with other (windows) compilers, conio.h was originally developped by borland and as far as i know is currently supported on Microsoft, Borland, and Bloodshed compilers.
__________________
|
|
|
|
|
|
#20 |
|
Hobbyist Programmer
|
conio.h is also evil
![]() (Personal opinion, at least) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|