include <iostream>
using namespace std;
int main () {
//declaring variables
double Pi= 3.1416 ;
double Diameter_ofcircle = 0.0;
double priceofrailingmaterial = 0.0;
double Totalpriceofrailingmaterial = 0.0;
//Getting the user input
cout<<"Enter the diameter of the circle ";
cin>>Diameter_ofcircle ;
cout<<"Enter the price of railing material per foot ";
cin>> priceofrailingmaterial ;
Totalpriceofrailingmaterial = ( (Diameter_ofcircle)* Pi ) * ( priceofrailingmaterial) ;
cout<<"Total price of railing material "<<Totalpriceofrailingmaterial<<endl;
return 0;
}
This is from codeblocks and I need to transfer this into Visual Studio Express 2010 C++ and this is what I have
#pragma once
namespace Diameter {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ lblPi;
protected:
private: System::Windows::Forms::TextBox^ txtPi;
private: System::Windows::Forms::Label^ lblDiameter;
protected:
private: System::Windows::Forms::TextBox^ txtDiameter;
private: System::Windows::Forms::Label^ lblPrice;
private: System::Windows::Forms::TextBox^ txtPrice;
private: System::Windows::Forms::Label^ lblTotal;
private: System::Windows::Forms::TextBox^ txtTotal;
private: System::Windows::Forms::Button^ btnClose;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->lblPi = (gcnew System::Windows::Forms::Label());
this->txtPi = (gcnew System::Windows::Forms::TextBox());
this->lblDiameter = (gcnew System::Windows::Forms::Label());
this->txtDiameter = (gcnew System::Windows::Forms::TextBox());
this->lblPrice = (gcnew System::Windows::Forms::Label());
this->txtPrice = (gcnew System::Windows::Forms::TextBox());
this->lblTotal = (gcnew System::Windows::Forms::Label());
this->txtTotal = (gcnew System::Windows::Forms::TextBox());
this->btnClose = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// lblPi
//
this->lblPi->AutoSize = true;
this->lblPi->Location = System::Drawing::Point(12, 90);
this->lblPi->Name = L"lblPi";
this->lblPi->Size = System::Drawing::Size(16, 13);
this->lblPi->TabIndex = 0;
this->lblPi->Text = L"Pi";
//
// txtPi
//
this->txtPi->BackColor = System::Drawing::SystemColors::Window;
this->txtPi->Location = System::Drawing::Point(124, 87);
this->txtPi->Name = L"txtPi";
this->txtPi->ReadOnly = true;
this->txtPi->Size = System::Drawing::Size(75, 20);
this->txtPi->TabIndex = 1;
this->txtPi->Text = L"3.1416";
//
// lblDiameter
//
this->lblDiameter->AutoSize = true;
this->lblDiameter->Location = System::Drawing::Point(12, 32);
this->lblDiameter->Name = L"lblDiameter";
this->lblDiameter->Size = System::Drawing::Size(89, 13);
this->lblDiameter->TabIndex = 2;
this->lblDiameter->Text = L"Diameter of circle";
//
// txtDiameter
//
this->txtDiameter->Location = System::Drawing::Point(122, 29);
this->txtDiameter->Name = L"txtDiameter";
this->txtDiameter->Size = System::Drawing::Size(77, 20);
this->txtDiameter->TabIndex = 3;
//
// lblPrice
//
this->lblPrice->AutoSize = true;
this->lblPrice->Location = System::Drawing::Point(12, 160);
this->lblPrice->Name = L"lblPrice";
this->lblPrice->Size = System::Drawing::Size(154, 13);
this->lblPrice->TabIndex = 4;
this->lblPrice->Text = L"Price of railing material per foot ";
//
// txtPrice
//
this->txtPrice->Location = System::Drawing::Point(194, 215);
this->txtPrice->Name = L"txtPrice";
this->txtPrice->Size = System::Drawing::Size(142, 20);
this->txtPrice->TabIndex = 5;
//
// lblTotal
//
this->lblTotal->AutoSize = true;
this->lblTotal->Location = System::Drawing::Point(12, 215);
this->lblTotal->Name = L"lblTotal";
this->lblTotal->Size = System::Drawing::Size(142, 13);
this->lblTotal->TabIndex = 6;
this->lblTotal->Text = L"Total price of raling material ";
//
// txtTotal
//
this->txtTotal->Location = System::Drawing::Point(194, 160);
this->txtTotal->Name = L"txtTotal";
this->txtTotal->Size = System::Drawing::Size(122, 20);
this->txtTotal->TabIndex = 7;
//
// btnClose
//
this->btnClose->Location = System::Drawing::Point(241, 336);
this->btnClose->Name = L"btnClose";
this->btnClose->Size = System::Drawing::Size(75, 23);
this->btnClose->TabIndex = 8;
this->btnClose->Text = L"Close";
this->btnClose->UseVisualStyleBackColor = true;
this->btnClose->Click += gcnew System::EventHandler(this, &Form1::btnClose_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(686, 418);
this->Controls->Add(this->btnClose);
this->Controls->Add(this->txtTotal);
this->Controls->Add(this->lblTotal);
this->Controls->Add(this->txtPrice);
this->Controls->Add(this->lblPrice);
this->Controls->Add(this->txtDiameter);
this->Controls->Add(this->lblDiameter);
this->Controls->Add(this->txtPi);
this->Controls->Add(this->lblPi);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void btnClose_Click(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
}
};
}
Diameter of circle is in a label and to enter its number is in a text box.
Pi is in a label and to enter its number is in a text box I have it to read only because its suppose to stay 3.1416.
Price of railing material per foot is in a label and to enter its number is in a text box.
Total price of railing material is in a label and to enter its number is in a text box.