In addition to development. net, Visual StudioProgramC, C ++Code, Easy to use, such as smart intelligence and debugging. In this example, vs2005 is used to calculate a combination of two numbers in three languages.
C program
- Create a C ++ Win32 console application
- Add the source file, select C ++ code, and enter. c
- Project properties-> Configuration properties-> C/C ++-> advanced, "compile as" select "compile as C code (/TC )"
Int Getsum ( Int A, Int B)
{
Return A + B;
}
VoidMain ()
{
Printf ("This is a standard C program! \ N");
Printf ("The sum is % d \ n", Getsum (6,9));
}
C ++ Program
- Create a C ++ Win32 console application
# Include < Iostream >
Using Namespace STD;
ClassSumc
{
Public:
IntA;
IntB;
IntGetsum ()
{
ReturnA+B;
}
};
Int Main ()
{
Cout < " This is a standard C ++ program! " < Endl;
Sumc OBJ;
OBJ. = 9 ;
OBJ. B = 6 ;
Cout < " The sum is " < OBJ. getsum () < Endl;
}
C # Program
- Create a C # console application
Using System;
Using System. Collections. Generic;
Using System. text;
Namespace CSHARP
{
Class Program
{
Static Void Main ( String [] ARGs)
{
Console. writeline ( " This is a C # program! " );
Sumc OBJ = New Sumc ();
Console. writeline ( " The sum is " + OBJ. getsum ( 9 , 6 ));
}
}
Class Sumc
{
Public Int Getsum ( Int A, Int B)
{
Return A + B;
}
}
}
Demo: Download
In one solution, the three projects need to be debugged to start the project.