C++ 程式設計/程式語言/比較/託管 C++
外觀
託管 C++ 是對 C++ 託管擴充套件的簡寫,它是來自 .NET 框架 的 微軟 的一部分。這種 C++ 語言的擴充套件是為了新增自動垃圾回收和堆管理、陣列的自動初始化以及對多維陣列的支援而開發的,簡化了在 C++ 中程式設計的所有那些細節,否則將由程式設計師完成。
託管 C++ 不會編譯成機器程式碼。相反,它被編譯成 通用中間語言,這是一種面向物件的機器語言,以前被稱為 MSIL。
#include<iostream.h>
#include<math.h>
void main()
{
int choose;
double Area,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')
{
double Radius;
const double pi=3.142;
cout<<"Enter Radius";
cin>>Radius;
Area=pi*pow(Radius,2);
}
else if(choose=='2')
{
double Length;
cout<<"Enter Length:";
cin>>Length;
Area= pow(1,2);
}
else if (choose=='3')
{
double Length,Width;
cout<<"Enter Length:";
cin>>Length;
cout<<"Enter Width:";
cin>>Width;
Area=Length*Width;
}
else if(choose=='4')
{
double Base,Height;
cout<<"Enter Base:";
cin>>Base;
cout<<"Enter Height:";
cin>>Height;
Area=Height*Base/2;
}
else
{
cout<<"Select only 1,2,3,4:";
goto loop;
}
cout<<"Area:"<<Area;
}