«

C,C++,C++/CLI sample program

Hi,

C program

1
2
3
4
5
6
7
8
c00.c
#include <stdio.h>

int main()
{
    printf("This is a native C program.\n");
    return 0;
} 

compile

> cl.exe c00.c

C++ program

1
2
3
4
5
6
7
8
c01.cpp
#include <iostream>

int main()
{
    std::cout << "This is a native C++ program." << std::endl;
    return 0;
}

compile

> cl.exe /EHsc c01.cpp

C++/CLI program

1
2
3
4
5
c02.cpp
int main()
{
    System::Console::WriteLine("This is a Visual C++ program.");
}

compile

> cl.exe /clr c02.cpp

That is very interesting!

comments powered by Disqus