Калькулятор
Калькулятор в С++Builder
Я должен создать Калькулятор и вот что у меня есть //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; float accum; int op; int f; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { f=0; op=0; StaticText1->Caption=0; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn0Click(TObject *Sender) { if (f!=0) StaticText1->Caption=StaticText1->Caption+ "0"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn1Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "1"; f=1; } else StaticText1->Caption=StaticText1->Caption + "1"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn2Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "2"; f=1; } else StaticText1->Caption=StaticText1->Caption + "2"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn3Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "3"; f=1; } else StaticText1->Caption=StaticText1->Caption + "3"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn4Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "4"; f=1; } else StaticText1->Caption=StaticText1->Caption + "4"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn5Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "5"; f=1; } else StaticText1->Caption=StaticText1->Caption + "5"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn6Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "6"; f=1; } else StaticText1->Caption=StaticText1->Caption + "6"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn7Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "7"; f=1; } else StaticText1->Caption=StaticText1->Caption + "7"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn8Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "8"; f=1; } else StaticText1->Caption=StaticText1->Caption + "8"; } //--------------------------------------------------------------------------- void __fastcall TForm1::Btn9Click(TObject *Sender) { if (f==0) { StaticText1->Caption= "9"; f=1; } else StaticText1->Caption=StaticText1->Caption + "9"; } //--------------------------------------------------------------------------- void __fastcall TForm1::BtnkClick(TObject *Sender) { if (f==0) { StaticText1->Caption= "0,"; f=1; } else { if (StaticText1->Caption.Pos(",")==0) StaticText1->Caption=StaticText1->Caption+","; } } //--------------------------------------------------------------------------- void __fastcall TForm1::BtnCClick(TObject *Sender) { StaticText1->Caption= "0"; accum=0; op=0; f=0; } //--------------------------------------------------------------------------- это работает но нужно хотя бы сложить(+), минус(-) или умножить(*) разделить (/) помоги отправь код если ты знаешь пожалуйста !!! |
Если запостите готовый исходник в архиве, то могу постараться вечером посмотреть и подсказать что к чему.
В этом же разбираться времени нет :( |
В самом деле, если у тебя есть исходник, а судя по тому, что ты создаёшь свой калькулятор, то исходник есть, ты б запаковал, и выставил на обозрение, не бойся, идею твою не украдём)))) А помочь, может и поможем, предыдущий человек прав, самому создавать интерфейс проги исходя из написанного не очень хочется, (потраченное время), без отдачи, так что выкладывай - не стесняйся... И отоментируй, хотя бы что нибудь, вообще возьми за правило, комментировать код, так даже тебе больше помогут, чем догадываться, не в обиду, но так проще будет... Удачки
|
Калькулятор был описан где-то в книжке: Бьерн Страуструп. Язык программирования С++. Можно еще нагуглить:
C++ calculator Example: sample C++ program for debugging Calculator in C++ Calculator program with functions |
народ прошу вас викласть код калькулятора який би обчислював arctg(x) або якісь посилання де можна це найти дуже треба ...(
Цитата:
|
Vaniok, официальный язык конференции - русский.
|
Время: 08:00. |
Время: 08:00.
© OSzone.net 2001-