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