Dev C++

Started by
30 comments, last by Plopfish 19 years, 9 months ago
Is there anything different about using this compiler compared to others? are there any tutorials geared directly toward it because i am having some problems with it? Thx in advance
Advertisement
Dev C++ is greta free compiler. I use and I like it. The only other think I would reccommend is VC++ and it costs money. So, freely speaking Dev C++ is one of the best.

What problems are you having?

(when posting a lot of lines of code put it between [.source] and [./source], leave out the dots. for less code(6 less lines) use [.code] [./code], without dots)
I also use Dev C++ even though I have Borland 5.0. I dunno, I just like Dev C++ better. What sort of problems are you having?
I wanna make a game.
well my window pos up and when i put in my number and press enter the windows goes away really fast and if i dont put the
cin.get() in it it doesnt stay up soo hers the code

//MY simple dum prog#include <iostream>using namespace std;int main()  {    int number;    cout << "Please enter a number";    cin >> number;    cout << "\n Is this your number ";    cout << number;    cin.get(); //use this to keep your windo open}

as you can see im just beginning so if anyone has a in-depth easy to understand tut for C++ can u give me a link
Yes, when you write a console program, after it has done everything it's supposed to (it does print the output, it just closes to quickly for you to see it) it closes, it sees no reaosn to stay open. If you run it form another console window that window will stay open and you can see your result.

It's not a weird problem ro anything, that's how it always works. Don't worry about it; when you get to games you'll have exit buttons and gameloops and such.
well how do i make another console or whatever
im pretty new at programming
Just open through another console window. Open a DOS window if you're using Windows 98, 95, Me, etc. Exp is just 'console window'.

Then us the cd command to get to the programs directory and type the filename.

Example: My program is called 'test.exe' and is located in C:\Test Porjects\misc

C:\>cd 'C:\Test Projects\misc'
C:\Test Projects\misc\>test

(program runs)


You don't have to do this; just use system("PAUSE"); or cin.get();
Quote:Original post by Tallshortkid
well my window pos up and when i put in my number and press enter the windows goes away really fast and if i dont put the
cin.get() in it it doesnt stay up soo hers the code

//MY simple dum prog#include <iostream>using namespace std;int main()  {    int number;    cout << "Please enter a number";    cin >> number;    cout << "\n Is this your number ";    cout << number;    cin.get(); //use this to keep your windo open}

as you can see im just beginning so if anyone has a in-depth easy to understand tut for C++ can u give me a link


You need to put another cin.get(); after the first one because there is still a '\n' in the input stream (stdin).

Or...use this tid bit:

...fflush( stdin ); // #include <stdin.h> and <stdio.h>system( "PAUSE" );...
well now i have
#include <iostream>using namespace std;int main() {    int number;cout << "Press enter to exit";while(cin.get() != '\n'){// Process according to your input cout<< number;}return 0;}


And it still closes before it prints out the numbers
Or you could do this too

#include <iostream>#include <conio.h>using namespace std;int main(){    ..code goes here   getch(); //wait for key}

This topic is closed to new replies.

Advertisement