Fehlermeldung in Visual Studio 2012:
1>------ Build started: Project: Calculator, Configuration: Debug Win32 ------
1> MyForm.cpp
1>c:\users\lulzsec\desktop\calculator\calculator\M yForm.h(191): warning C4244: '=' : conversion from 'wchar_t' to 'char', possible loss of data
1>LINK : fatal error LNK1561: entry point must be defined
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
danke
Code:
#pragma once
namespace Calculator {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
/// <summary>
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TextBox^ textBox1;
protected:
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::Label^ label2;
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->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button5 = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(82, 84);
this->textBox1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(234, 30);
this->textBox1->TabIndex = 0;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(82, 198);
this->textBox2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(234, 30);
this->textBox2->TabIndex = 1;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(166, 139);
this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(64, 25);
this->label1->TabIndex = 2;
this->label1->Text = L"label1";
//
// button1
//
this->button1->Location = System::Drawing::Point(489, 81);
this->button1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(140, 41);
this->button1->TabIndex = 3;
this->button1->Text = L"+";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(489, 139);
this->button2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(140, 50);
this->button2->TabIndex = 4;
this->button2->Text = L"-";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &MyForm::button2_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(489, 198);
this->button3->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(140, 48);
this->button3->TabIndex = 5;
this->button3->Text = L"*";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &MyForm::button3_Click);
//
// button4
//
this->button4->Location = System::Drawing::Point(489, 256);
this->button4->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(140, 47);
this->button4->TabIndex = 6;
this->button4->Text = L"/";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &MyForm::button4_Click);
//
// button5
//
this->button5->Location = System::Drawing::Point(142, 256);
this->button5->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(112, 36);
this->button5->TabIndex = 7;
this->button5->Text = L"=";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this, &MyForm::button5_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(166, 305);
this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(64, 25);
this->label2->TabIndex = 8;
this->label2->Text = L"label2";
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(12, 25);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(801, 403);
this->Controls->Add(this->label2);
this->Controls->Add(this->button5);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->Name = L"MyForm";
this->Text = L"Calculator";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "+";
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "-";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "*";
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "/";
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
char sw;
double a, b, erg;
sw = System::Convert::ToChar(label1->Text);
a = System::Convert::ToDouble(textBox1->Text);
b = System::Convert::ToDouble(textBox2->Text);
switch(sw)
{
case '+':
erg = a + b;
break;
case '-':
erg = a - b;
break;
case '*':
erg = a * b;
break;
case '/':
erg = a / b;
break;
}
label2->Text = System::Convert::ToString(erg);
}
};
}
Code:
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "+";
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "-";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "*";
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "/";
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
char sw;
double a, b, erg;
sw = System::Convert::ToChar(label1->Text);
a = System::Convert::ToDouble(textBox1->Text);
b = System::Convert::ToDouble(textBox2->Text);
switch(sw)
{
case '+':
erg = a + b;
break;
case '-':
erg = a - b;
break;
case '*':
erg = a * b;
break;
case '/':
erg = a / b;
break;
}
label2->Text = System::Convert::ToString(erg);
}
};
}






