For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > My first C++ Application in VC++ 2005 Express!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author My first C++ Application in VC++ 2005 Express!
Davin Eastley

2005-06-06, 8:59 am

Dear All,

My name is Davin Eastley and I'm 13 years old. I wrote my first C++ 2005
Application yesterday with no resources by playing around with C++ Express
Edition for half the day. I assigned x as an int (with the value of 20) and
got the compiler to tell me whether it was greater than 2 or not. This was
the code I used:

private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e)
{


int x;

x = 1;

//this assigns x as an int

//(a variable - data type -)


if (x >= 2)

{

// if x is greater than 2, output a messagebox saying x is greater than 2.

MessageBox::Show(L"x is greater than 2!");

}

if (x < 2)

{

// if x is lower than 2, output a messagebox saying x is lower than 2.

MessageBox::Show(L"x is lower than 2!");

}


}

This is straight from the compiler. This is the new style of C++ 2005. I am
very happy to write my first application in C++. I also wrote a console
application which uses Console::WriteLine instead of the messagebox
equivalent. I still want to know how to use the cout and cin keywords
though. Time to do some more learning on C++!



Regards,

Davin Eastley

--------------

www.davineastley.tk

Forums Home


Davin Eastley

2005-06-06, 8:59 am

I based this on my knowledge in C# so the C++ Express team have done a good
job simplifying it! I commend the team working on it and wish them the best
of luck. I am currently training for MCAD certification in C# and I wish
that the C++ exams would come back to the Language Choices for MCAD
Certification.

Regards,
Davin Eastley

---------
www.davineastley.tk
Forums Home


"Davin Eastley" <davineastley@netspace.net.au> wrote in message
news:utqANqmaFHA.3384@TK2MSFTNGP09.phx.gbl...
> Dear All,
>
> My name is Davin Eastley and I'm 13 years old. I wrote my first C++ 2005
> Application yesterday with no resources by playing around with C++ Express
> Edition for half the day. I assigned x as an int (with the value of 20)
> and got the compiler to tell me whether it was greater than 2 or not. This
> was the code I used:
>
> private: System::Void button1_Click(System::Object^ sender,
> System::EventArgs^ e)
> {
>
>
> int x;
>
> x = 1;
>
> //this assigns x as an int
>
> //(a variable - data type -)
>
>
> if (x >= 2)
>
> {
>
> // if x is greater than 2, output a messagebox saying x is greater than 2.
>
> MessageBox::Show(L"x is greater than 2!");
>
> }
>
> if (x < 2)
>
> {
>
> // if x is lower than 2, output a messagebox saying x is lower than 2.
>
> MessageBox::Show(L"x is lower than 2!");
>
> }
>
>
> }
>
> This is straight from the compiler. This is the new style of C++ 2005. I
> am very happy to write my first application in C++. I also wrote a console
> application which uses Console::WriteLine instead of the messagebox
> equivalent. I still want to know how to use the cout and cin keywords
> though. Time to do some more learning on C++!
>
>
>
> Regards,
>
> Davin Eastley
>
> --------------
>
> www.davineastley.tk
>
> Forums Home
>
>



George Huber

2005-06-07, 4:05 pm

Davin Eastley wrote:
> Dear All,
>
> My name is Davin Eastley and I'm 13 years old. I wrote my first C++ 2005
> Application yesterday with no resources by playing around with C++ Express
> Edition for half the day. I assigned x as an int (with the value of 20) and
> got the compiler to tell me whether it was greater than 2 or not. This was
> the code I used:
>
> private: System::Void button1_Click(System::Object^ sender,
> System::EventArgs^ e)
> {
>
>
> int x;
>
> x = 1;
>
> //this assigns x as an int
>
> //(a variable - data type -)
>
>
> if (x >= 2)
>
> {
>
> // if x is greater than 2, output a messagebox saying x is greater than 2.
>
> MessageBox::Show(L"x is greater than 2!");
>
> }
>
> if (x < 2)
>
> {
>
> // if x is lower than 2, output a messagebox saying x is lower than 2.
>
> MessageBox::Show(L"x is lower than 2!");
>
> }
>
>
> }
>
> This is straight from the compiler. This is the new style of C++ 2005. I am
> very happy to write my first application in C++. I also wrote a console
> application which uses Console::WriteLine instead of the messagebox
> equivalent. I still want to know how to use the cout and cin keywords
> though. Time to do some more learning on C++!
>
>
>
> Regards,
>
> Davin Eastley
>
> --------------
>
> www.davineastley.tk
>
> Forums Home
>
>

Davin,

Ummm, not to burst you bubble or anything, but what you posted does not
look like C++ code. Consider you function header:

> private: System::Void button1_Click(System::Object^ sender,
> System::EventArgs^ e)


The caret (^) is the bit-wise exclusive or operator in C++, and can not
be used as type decorator so I am not quite sure what 'System::Object^'
is.

I strongly suggest getting a good reference on C++ (see the list at
http://www.accu.org/bookreviews/pub...inner_s_c__.htm)
for a list of _very_ good beginning C++ resources.

While the VC++ 2005 might be a good compiler, I beleive that it brings
along the dotNet framework as well as managed C++. These may all be
good things, but I feel you should learn C++ proir to jumping into
all the non-standard extentions that Microsoft has built in. To this
end I would suggest, at least for the start, using something like
mingwStudio (http://www.parinyasoft.com/). Once you have a strong
footing in standard C++ you then can move into dotNet, managed C++
and the like.

George
Mark Ingram

2005-06-07, 4:05 pm


> Davin,
>
> Ummm, not to burst you bubble or anything, but what you posted does not
> look like C++ code. Consider you function header:
>


Actually, that "^" is the new symbol for a garbage collection managed
pointer. Managed C++ (which is what hes using) gets between
real pointers and GC pointers. So a new operator was designed.

CString* pMyString; // Normal C++ pointer
String^ pMyString2; // New Managed C++ pointer

Hope that helps
George Huber

2005-06-07, 4:05 pm

Mark Ingram wrote:
>
>
> Actually, that "^" is the new symbol for a garbage collection managed
> pointer. Managed C++ (which is what hes using) gets between
> real pointers and GC pointers. So a new operator was designed.
>
> CString* pMyString; // Normal C++ pointer
> String^ pMyString2; // New Managed C++ pointer
>
> Hope that helps


I sort-of though that the caret (^) was a non-standard microsoft
extention to the language (as is managed C++ a non-standard
extention).

My advice to his still is to learn _standard_ C++ before attempting
to learn Microsoft's extentions to the language. A strong knowledge
of standard C++ will carry Davin far, and he will not be limiting
himself to Microsoft only platforms.

George
Carl Daniel [VC++ MVP]

2005-06-07, 4:05 pm

"George Huber" <huber_geo@hotmail.com> wrote in message >
> I sort-of thought that the caret (^) was a non-standard microsoft
> extention to the language (as is managed C++ a non-standard
> extention).
>
> My advice to his still is to learn _standard_ C++ before attempting
> to learn Microsoft's extentions to the language. A strong knowledge
> of standard C++ will carry Davin far, and he will not be limiting
> himself to Microsoft only platforms.


Not to argue (I agree completely, in fact), but the new "C++/CLI" extensions
are also being standardized (through ECMA) and should eventually show up in
other C++ compilers that target the CLI (.NET, Mono, etc).

-cd


andré m.a

2005-06-07, 9:00 pm

>
> My name is Davin Eastley and I'm 13 years old. I wrote my first C++ 2005
> Application yesterday with no resources by playing around with C++ Express
> Edition for half the day. I assigned x as an int (with the value of 20)
> and got the compiler to tell me whether it was greater than 2 or not. This
> was the code I used:


> Davin Eastley


Good for you ! I wrote a peace at 13 as well but back then
it was on a Commodore 64 using Basic =] .

I'd like to invite you to consider geting a book on c++
and write small Console applications to start. If you take the road
that goes through VisualC++ you need to learn a lot more then c++.
For exemple you'd have to learn about using the Enviroment, the APIs,
libraries that are build-in.. All of wich require you a clear understanding
of C++ to begin with... It can be done but its realy like trying to hammer
a nail with a pencil.

But you have all the time you need to decide what you want to do realy ;)



George Huber

2005-06-07, 9:00 pm

Carl Daniel [VC++ MVP] wrote:
> "George Huber" <huber_geo@hotmail.com> wrote in message >
>
>
>
> Not to argue (I agree completely, in fact), but the new "C++/CLI" extensions
> are also being standardized (through ECMA) and should eventually show up in
> other C++ compilers that target the CLI (.NET, Mono, etc).
>
> -cd
>
>

So when will the C++/CLI extensions show up in ISO/ansi C++?

Never I suspect.

Maybe I am jaded or overly conservative, but I view standard C++ as what
is defined by the ISO/ansi committee.

I know that there is no pure C++ compiler available today, in that every
compiler adds something to the language -- although in most cases these
are new types or additional functions in the standard libraries. For
example the type 'long long' is not a valid ansi type, but it is
accepted by the gnu compiler. However, I know of no compiler that adds
additional operands and still claims to be the same language. Maybe, if
Microsoft wants to continue down this path they should claim that the
language is a _new_ langauge and drop all references to C++?

George
William DePalo [MVP VC++]

2005-06-07, 9:00 pm

"George Huber" <huber_geo@hotmail.com> wrote in message
news:O2ufyK5aFHA.3932@TK2MSFTNGP12.phx.gbl...
> Maybe, if Microsoft wants to continue down this
> path they should claim that the language is a _new_ langauge and drop all
> references to C++?


That would be a good plan if it was not possible to mix metaphors - if it
was not possible to craft an application that contained instances of classes
allocated on .Net's garbage collected heap as well as instances of native
classes allocated dynamically in the standard way or on the stack using ISO
standard C++ idioms. Right now, C++/CLI's forte is that is equally strong on
both sides of the boundary between the "managed" and native environments.

Standard C++ and C++/CLI are different languages with a shared heritage that
goes back to K&R.

Regards,
Will


Carl Daniel [VC++ MVP]

2005-06-07, 9:00 pm


"George Huber" <huber_geo@hotmail.com> wrote in message
news:O2ufyK5aFHA.3932@TK2MSFTNGP12.phx.gbl...
> Carl Daniel [VC++ MVP] wrote:
> So when will the C++/CLI extensions show up in ISO/ansi C++?
>
> Never I suspect.


Actually, the ECMA standard will become an ISO standard shortly after
approval by ECMA. When will CLI bindings show up in a descendant of ISO
14882? Probably never - as it should be. C++ and C++/CLI are different
(but related) languages.

Will ideas from C++/CLI find their way into "native" C++? Likely. The ECMA
committee has many members of the ISO C++ committee, and the two groups
coordinate their efforts on areas where they overlap.

-cd


Davin Eastley

2005-06-08, 4:02 am

Thanks everybody. The information should help. Andre - thanks for your
message also. I have written applications in QBASIC before. And I have
written applications in C#, Visual Basic .NET and now one in VC++ Express.

Regards,
Davin Eastley

----------
www.davineastley.tk
Forums Home


"Davin Eastley" <davineastley@netspace.net.au> wrote in message
news:utqANqmaFHA.3384@TK2MSFTNGP09.phx.gbl...
> Dear All,
>
> My name is Davin Eastley and I'm 13 years old. I wrote my first C++ 2005
> Application yesterday with no resources by playing around with C++ Express
> Edition for half the day. I assigned x as an int (with the value of 20)
> and got the compiler to tell me whether it was greater than 2 or not. This
> was the code I used:
>
> private: System::Void button1_Click(System::Object^ sender,
> System::EventArgs^ e)
> {
>
>
> int x;
>
> x = 1;
>
> //this assigns x as an int
>
> //(a variable - data type -)
>
>
> if (x >= 2)
>
> {
>
> // if x is greater than 2, output a messagebox saying x is greater than 2.
>
> MessageBox::Show(L"x is greater than 2!");
>
> }
>
> if (x < 2)
>
> {
>
> // if x is lower than 2, output a messagebox saying x is lower than 2.
>
> MessageBox::Show(L"x is lower than 2!");
>
> }
>
>
> }
>
> This is straight from the compiler. This is the new style of C++ 2005. I
> am very happy to write my first application in C++. I also wrote a console
> application which uses Console::WriteLine instead of the messagebox
> equivalent. I still want to know how to use the cout and cin keywords
> though. Time to do some more learning on C++!
>
>
>
> Regards,
>
> Davin Eastley
>
> --------------
>
> www.davineastley.tk
>
> Forums Home
>
>



Hendrik Schober

2005-06-08, 9:00 am

William DePalo [MVP VC++] <willd.no.spam@mvps.org> wrote:
> "George Huber" <huber_geo@hotmail.com> wrote in message
> news:O2ufyK5aFHA.3932@TK2MSFTNGP12.phx.gbl...
>
> That would be a good plan if it was not possible to mix metaphors [...]


The same goes for C/C++.
Still, they have different (even though similar)
names.

> Will



Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com