Jump to content

Recommended Posts

Posted

Hello,

when i do this:

#include <iostream.h>

int main()

{

cout << "Hello World!\n";

return 0;

}

he will open the .exe and close it immediatly...

how can i fix this?

thanks


Posted
#include <iostream.h>

using namespace std;

int main()
{
cout << "Hello World!\n";
system("PAUSE");  // will ask user to press any key to exit
return 0;
}

Posted

Its in a DOS prompt (command prompt) because you haven't developed a GUI for it yet... Don't worry... This is how C++ starts out for everyone (mostly)... Even I'm still learning using this as well... :D

Posted

but it looks not like a program now but a bat file or something.

how can i change the GUI?,

and is there a tutorial or something how to add a textfield ? were you can write in ect..?

and i want to know how i can change my title of the screen

thnx

Posted

what is your goal, and you already posted this question in another thread, I answered the original question there. As for the gui, you cant directly, other than doing the system commands for a dos prompt. If you want to use a window then you need to create it in code, not someting you can do in three lines. You need to google it and there are lots of exmaples on how to create a window.

  • 1 month later...
Posted

Dev-C++ is one of the best freeware programs out there. It comes with the g++ compiler built right in and handles multiple files very well (when you get to that stage).

Posted
how can i change the GUI?,

and is there a tutorial or something how to add a textfield ? were you can write in ect..?

I think that for a pretty GUI, you need to learn about MFC (Microsoft Framework Controls) - I think that's what it's called. This isn't the same thing as .NET Framework, but it's the core of the Windows GUI that's available to programmers.

I can tell you with great confidence right now that you should stick with the command line interface for the time being until you get a hold of all the finer details of programming (memory management, data structures, etc). Once you've got those things under control, porting your work over to a GUI is a piece of cake.

Posted

if you are a total 'newbie' in c++ then i don't think you will learn much of just asking in a forum.. start with reading a good book! 'thinking in c++' and 'teach your self c++ in 21 days' are some kick starting stuff so you will understand things fast.. well, atleast i did.. but i've programmed in vb for some years so i think that helped me alot for the move to c++.. :)

  • 3 weeks later...
Posted

I agree. Its a good idea not to rush yourself or bite off too much at once. When I started programming I just wanted to hurry up and make something cool I could run on windows. I've had two classes in C++ and one in assembly language (if you don't like c++ try a good old ASM course... its a real b**** lol). and I still get confused with all the different components of visual programming (partly because I get distracted easily partly because i haven't really been programming for about a year :P) and well I'm still impatient.

here's a way to keep the console from closing -- basically the best ways are add code that waits for a keypress, or open a command prompt and then call it from within the prompt.

As for going visual, I tried Visual C++ 6 in 24 hours (although I was reading about an "hour" a day and i still haven't managed to finish the book... :whistle: ) Note: that means i'm lazy and i get sidetracked easily and isn't meant to down the book, although for me it did kind of drag along at a slow pace

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...