Jump to content
Wikibooks The Free Textbook Project

C++ Programming/Programming Languages/Comparisons/Managed C++

From Wikibooks, open books for an open world

Managed C++ (C++/CLI)

[edit | edit source ]

Managed C++ is a shorthand notation for Managed Extensions for C++, which are part of the .NET framework from Microsoft. This extension of the C++ language was developed to add functionality like automatic garbage collection and heap management, automatic initialization of arrays, and support for multidimensional arrays, simplifying all those details of programming in C++ that would otherwise have to be done by the programmer.

Managed C++ is not compiled to machine code. Rather, it is compiled to Common Intermediate Language, which is an object-oriented machine language and was formerly known as MSIL.

#include<iostream.h>
#include<math.h>
voidmain()
{
intchoose;
doubleArea,Length,Width,Radius,Base,Height;
cout<<"circle(1)";
cout<<"Square(2)";
cout<<"Rectangle(3)";
cout<<"Triangle(4)";
cout<<"select 1,2,3,4:";
loop:
cin>>choose;
if(choose=='1')
{
doubleRadius;
constdoublepi=3.142;
cout<<"Enter Radius";
cin>>Radius;
Area=pi*pow(Radius,2);
}
elseif(choose=='2')
{
doubleLength;
cout<<"Enter Length:";
cin>>Length;
Area=pow(1,2);
}
elseif(choose=='3')
{
doubleLength,Width;
cout<<"Enter Length:";
cin>>Length;
cout<<"Enter Width:";
cin>>Width;
Area=Length*Width;
}
elseif(choose=='4')
{
doubleBase,Height;
cout<<"Enter Base:";
cin>>Base;
cout<<"Enter Height:";
cin>>Height;
Area=Height*Base/2;
}
else
{
cout<<"Select only 1,2,3,4:";
gotoloop;
}
cout<<"Area:"<<Area;
}

AltStyle によって変換されたページ (->オリジナル) /