// Classes_Part1.cpp : main project file. /* _____________________________________________________ W O R K I N G W I T H C L A S S E S P A R T 1 Ron Kessler Created 1/22/2017 CLR VERSION This simple app shows how to create a Rectangle object in code so we can find the area of the object. The user inputs width and height and then we do the math and print the result on screen. Imagine you need to find the area of a room so you can buy new carpet. Well, we are going to create an app to do that. _____________________________________________________ */ #include "stdafx.h" #include "Room.h" //add this so we can use our new class using namespace System; int main(array ^args) { //---create a new Rectangle object Room^ myRoom = gcnew Room; Console::WriteLine ("Welcome to My Room Area Calculator\n\n"); //---define vars to hold user data double myWidth; double myLength; //*********INPUT********** Console::Write("Please enter the width of the room "); myWidth = Convert::ToDouble(Console::ReadLine()); myRoom->setWidth (myWidth); //assign value to myRoom object Console::Write("Please enter the length of the room "); myLength = Convert::ToDouble (Console::ReadLine() ); myRoom->setLength (myLength); //assign value to myRoom object //*********PROCESSING IS DONE IN THE MYROOM OBJECT********** //*********OUTPUT********** Console::Clear (); Console::WriteLine("\n\n" "Here are your dimensions: \n"); Console::WriteLine("The width is : " + myRoom->getWidth ().ToString ("n2") + "\n"); Console::WriteLine("The length is : " + myRoom->getLength ().ToString ("n2") + "\n"); Console::WriteLine("The area is : " + myRoom->getArea ().ToString("n2") + "\n"); Console::ReadKey (); return 0; }