MSFN Forum: C++ Beginner Needs Help - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

C++ Beginner Needs Help Rate Topic: -----

#1 User is offline   Highor 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 04-March 05

Posted 26 March 2005 - 06:20 AM

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


#2 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,019
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 March 2005 - 10:46 AM

#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;
}


#3 User is offline   Highor 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 04-March 05

Posted 26 March 2005 - 11:35 AM

Thanks.

and the next question is, why is it in a DOS promt?

in history i had a "windows window" with text in it.

how can i fix this?

( Example: http://www.highor.com/likethis.JPG )

#4 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,019
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 March 2005 - 11:55 AM

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

#5 User is offline   Highor 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 04-March 05

Posted 26 March 2005 - 12:50 PM

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

#6 User is offline   purewaveform 

  • Member
  • PipPip
  • Group: Members
  • Posts: 142
  • Joined: 24-March 05

Posted 30 March 2005 - 03:08 PM

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.

#7 User is offline   Juice011 

  • Group: Members
  • Posts: 1
  • Joined: 08-May 05

  Posted 08 May 2005 - 08:30 PM

Hey all im interested in starting using C++ but i cant seem to find a good compiler to use anyone have a good one thats free?

#8 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 08 May 2005 - 10:33 PM

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).

#9 User is offline   dman 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 717
  • Joined: 01-February 05

Posted 08 May 2005 - 11:48 PM

Free MS .NET SDK has compiler
http://www.microsoft.com/downloads/details...&displaylang=en

#10 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 09 May 2005 - 08:49 AM

Bloodshed software for a good free IDE.

#11 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 09 May 2005 - 11:51 PM

Highor, on Mar 26 2005, 10:50 AM, said:

how can i change the GUI?,
and is there a tutorial or something how to add a textfield ? were you can write in ect..?
<{POST_SNAPBACK}>


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.

#12 User is offline   Fork18 

  • Group: Members
  • Posts: 8
  • Joined: 18-February 05

Posted 16 May 2005 - 06:10 AM

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++.. :)

#13 User is offline   spiritpyre 

  • Grand Poobah
  • PipPip
  • Group: Members
  • Posts: 191
  • Joined: 28-April 05

Posted 05 June 2005 - 10:02 PM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy