Author Topic: [C++.NET]Hello World  (Read 1524 times)

Offline .Fusion

  • Newbie
  • *
  • Posts: 24
  • Rep: 0
    • View Profile
[C++.NET]Hello World
« on: March 08, 2007, 05:45:07 pm »
c++ 2005...

Anyways to get started..

Open Microsoft C++ studio, create a new CLR Console application.

Now you should be in code mode add this source I will explain rest in a minute.

Code: [Select]
// Hello World1.cpp : main project file.

#include "stdafx.h"

using namespace System;

int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
    return 0;
}

Ok the
Code: [Select]
// Hello World1.cpp : main project file.
Is telling us the project name so when you click on new CLR Console application at the bottom it will ask you for a name and I put "Hello World1" seeing as I already had a "Hello World".

Now
Code: [Select]
#include "stdafx.h"
Is telling us we have an include named stadfx.h.

Code: [Select]
using namespace System;
Is pretty simple its basicly using the namespace System to write lines.

Code: [Select]
int main(array<System::String ^> ^args)
That is going to make the lines so they write onto the Application.

Code: [Select]
Console::WriteLine(L"Hello World!");
This is very important. That is going to write the line "Hello World!"
Always write lines using the
Code: [Select]
Console::WriteLine
Method. You must have the (L" in there or else it will not print the line, you also need the ; telling it its the end of the line.

The } is telling it its the end of the project so it can stop and wont go any furthur.

Note: When de bugging click Debug> Start without debugging.

Freddy1990.com

[C++.NET]Hello World
« on: March 08, 2007, 05:45:07 pm »

Offline Global

  • VB Moderator
  • Sr. Member
  • ****
  • Posts: 375
  • Rep: 2
    • View Profile
    • Email
Re: [C++.NET]Hello World
« Reply #1 on: March 08, 2007, 10:11:57 pm »
Looks good. Thumbs up.
Please Don't P.M About SCAR, I'm on the basics with it also :P.

Freddy1990.com

Re: [C++.NET]Hello World
« Reply #1 on: March 08, 2007, 10:11:57 pm »

Offline Zoiked

  • Full Member
  • ***
  • Posts: 125
  • Rep: 0
  • What happens if I put text here. :P
    • MSN Messenger - Bllizzd@gmail.com
    • View Profile
    • ZoikedNet
Re: [C++.NET]Hello World
« Reply #2 on: March 09, 2007, 01:06:12 pm »
This is a nice tutorial but some pictures and color are always a plus. Anyways, Thumbs Up!

Offline sparkz

  • Leecher
  • Posts: 3
  • Rep: 0
    • View Profile
Re: [C++.NET]Hello World
« Reply #3 on: April 16, 2007, 12:30:29 pm »
You sure you know c++.. ?

Offline Zoiked

  • Full Member
  • ***
  • Posts: 125
  • Rep: 0
  • What happens if I put text here. :P
    • MSN Messenger - Bllizzd@gmail.com
    • View Profile
    • ZoikedNet
Re: [C++.NET]Hello World
« Reply #4 on: April 16, 2007, 10:15:50 pm »
You sure you know c++.. ?

This is C++.NET instead of ANSI C++. There are slight differences in the variations of the styles of this language C++.

Regular C++
Code: [Select]
cout << "Hello World!" << endl;
C++.NET
Code: [Select]
Console::WriteLine(L"Hello World");
Basically, C++.NET is Microsofts bull shit version of C++ for the .NET Framework.

Freddy1990.com

Re: [C++.NET]Hello World
« Reply #4 on: April 16, 2007, 10:15:50 pm »

Offline sparkz

  • Leecher
  • Posts: 3
  • Rep: 0
    • View Profile
Re: [C++.NET]Hello World
« Reply #5 on: April 17, 2007, 10:18:10 am »
I know ;)

I was mainly making reference to the inaccurate/not very detailed and in some places completely wrong comments, e.g:

Quote
int main(array<System::String ^> ^args)

That is going to make the lines so they write onto the Application.

That's just completely pulled out of his ass.


Freddy1990.com

Re: [C++.NET]Hello World
« Reply #5 on: April 17, 2007, 10:18:10 am »