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

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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>
 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;
 }