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
Hello World
Started by aurelABHR, Jun 30 2008 01:12 PM
6 replies to this topic
#1
Posted 30 June 2008 - 01:12 PM
|
|
|
#2
Posted 30 June 2008 - 01:25 PM
Google for:
"hello world" C++
to get numerous results.
"hello world" C++
to get numerous results.
#3
Posted 30 June 2008 - 03:32 PM
#4
Posted 30 June 2008 - 09:27 PM
Hey dargueta this is console i need window example:D
#5
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 testI 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.
#6
Posted 30 June 2008 - 10:55 PM
This is something oK.thanks
#7
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.


Sign In
Create Account


Back to top









