Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Hello World

hello world

  • Please log in to reply
6 replies to this topic

#1 aurelABHR

aurelABHR

    CC Regular

  • Member
  • PipPipPip
  • 26 posts

Posted 30 June 2008 - 01:12 PM

Hello Experts in C++!
I need small example how writte well know Hello World code in C++.
So i need first open new window,then show text Hello Wold.
regards
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 30 June 2008 - 01:25 PM

Google for:
"hello world" C++
to get numerous results.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#3 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 30 June 2008 - 03:32 PM

Hello World in C++
  • 0

#4 aurelABHR

aurelABHR

    CC Regular

  • Member
  • PipPipPip
  • 26 posts

Posted 30 June 2008 - 09:27 PM

Hey dargueta this is console i need window example:D
  • 0

#5 v0id

v0id

    Retired

  • Retired Mod
  • PipPipPipPipPipPipPipPip
  • 2313 posts

Posted 30 June 2008 - 10:33 PM

Here's a cross-platform example using wxWidgets:
// test.cpp

#include <wx/wx.h>

class MyFirstApplication
    : public wxApp
{
    public:
        bool OnInit();
};

class MyFirstFrame
    : public wxFrame
{
    public:
        MyFirstFrame(wxString title)
            : wxFrame(NULL, -1, title, wxDefaultPosition, wxDefaultSize)
        {
            wxStaticText *text = new wxStaticText(this, -1, wxT("Hello, World!"), 
                                                  wxDefaultPosition, wxDefaultSize);
            
            this->SetSize(text->GetSize());
        }
};

IMPLEMENT_APP(MyFirstApplication)

bool MyFirstApplication::OnInit()
{
    MyFirstFrame *frame = new MyFirstFrame(wxT("Hello, World!"));
    
    frame->Show(true);
    this->SetTopWindow(frame);
    
    return true;
}
And how to compile:
$ g++ test.cpp `wx-config --libs --cxxflags` -o test
I coded the constructor for the MyFirstFrame-class simple, so that it only accept the title in this example. In a real-world situation you would usually let it accept more parameters, like position, size and maybe also window decoration.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#6 aurelABHR

aurelABHR

    CC Regular

  • Member
  • PipPipPip
  • 26 posts

Posted 30 June 2008 - 10:55 PM

This is something oK.thanks
  • 0

#7 MeTh0Dz

MeTh0Dz

    CC Leader

  • Just Joined
  • PipPipPipPipPipPipPip
  • 1726 posts

Posted 01 July 2008 - 03:16 AM

Don't come on here and ask people to make code for you, search the net there are plenty of resources.
  • 0





Also tagged with one or more of these keywords: hello world

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download