Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how do you add these functions to a code + / * + / * - sin , , con,tan ? ? #include CalFrame.h
how do you add these functions to a code +/*− sin,con,tan?#include "CalFrame.h"
#include
enum {
ID_BUTTON_0= wxID_HIGHEST +1,
ID_BUTTON_1,
ID_BUTTON_2,
ID_BUTTON_3,
ID_BUTTON_4,
ID_BUTTON_5,
ID_BUTTON_6,
ID_BUTTON_7,
ID_BUTTON_8,
ID_BUTTON_9,
ID_BUTTON_PLUS,
ID_BUTTON_MINUS,
ID_BUTTON_MULTIPLY,
ID_BUTTON_DIVIDE,
ID_BUTTON_MOD,
ID_BUTTON_DECIMAL,
ID_BUTTON_CLEAR,
ID_BUTTON_ENTER,
ID_BUTTON_TAN,
ID_BUTTON_SIN,
ID_BUTTON_CON,
ID_BUTTON_NEGATIVE,
ID_BUTTON_BACKSPACE
};
CalFrame::CalFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(nullptr, wxID_ANY, title, pos, size)
{
textControl = new wxTextCtrl(this, wxID_ANY, "", wxPoint(10,10), wxSize(260,30), wxTE_READONLY);
new wxButton(this, ID_BUTTON_1,"1", wxPoint(10,50), wxSize(50,50));
new wxButton(this, ID_BUTTON_2,"2", wxPoint(60,50), wxSize(50,50));
new wxButton(this, ID_BUTTON_3,"3", wxPoint(110,50), wxSize(50,50));
new wxButton(this, ID_BUTTON_4,"4", wxPoint(10,100), wxSize(50,50));
new wxButton(this, ID_BUTTON_5,"5", wxPoint(60,100), wxSize(50,50));
new wxButton(this, ID_BUTTON_6,"6", wxPoint(110,100), wxSize(50,50));
new wxButton(this, ID_BUTTON_7,"7", wxPoint(10,150), wxSize(50,50));
new wxButton(this, ID_BUTTON_8,"8", wxPoint(60,150), wxSize(50,50));
new wxButton(this, ID_BUTTON_9,"9", wxPoint(110,150), wxSize(50,50));
new wxButton(this, ID_BUTTON_DECIMAL, ".", wxPoint(10,200), wxSize(50,50));
new wxButton(this, ID_BUTTON_0,"0", wxPoint(60,200), wxSize(50,50));
new wxButton(this, ID_BUTTON_NEGATIVE, "(−)", wxPoint(110,200), wxSize(50,50));
new wxButton(this, ID_BUTTON_PLUS, "+", wxPoint(170,50), wxSize(50,50));
new wxButton(this, ID_BUTTON_MINUS, "−", wxPoint(220,50), wxSize(50,50));
new wxButton(this, ID_BUTTON_MULTIPLY, "*", wxPoint(170,100), wxSize(50,50));
new wxButton(this, ID_BUTTON_DIVIDE, "/", wxPoint(220,100), wxSize(50,50));
new wxButton(this, ID_BUTTON_MOD, "%", wxPoint(170,150), wxSize(50,50));
new wxButton(this, ID_BUTTON_SIN, "SIN", wxPoint(220,150), wxSize(50,50));
new wxButton(this, ID_BUTTON_CON, "CON", wxPoint(170,200), wxSize(50,50));
new wxButton(this, ID_BUTTON_TAN, "TAN", wxPoint(220,200), wxSize(50,50));
new wxButton(this, ID_BUTTON_BACKSPACE, "<−", wxPoint(170,250), wxSize(100,50));
new wxButton(this, ID_BUTTON_ENTER, "=", wxPoint(10,250), wxSize(150,50));
new wxButton(this, ID_BUTTON_CLEAR, "CLEAR", wxPoint(10,300), wxSize(260,50));
Bind(wxEVT_BUTTON, &CalFrame::OnButtonClicked, this, ID_BUTTON_0, ID_BUTTON_9);
Bind(wxEVT_BUTTON, &CalFrame::OnClearButtonClick, this, ID_BUTTON_CLEAR);
}
void CalFrame::OnButtonClicked(wxCommandEvent& event)
{
int buttonId = event.GetId();
wxString buttonText = wxString::Format("%c", buttonId − ID_BUTTON_ 0 + ' 0 ' ) " id="MathJax-Element-240-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">_0+'0');
if (buttonId >= ID_BUTTON_0 && buttonId <= ID_BUTTON_9){
buttonText = wxString::Format("%c", buttonId − ID_BUTTON_ 0 + ' 0 ' ) " id="MathJax-Element-253-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">_0+'0');
}
else {
switch (buttonId){
case ID_BUTTON_PLUS:
buttonText ="+";
break;
case ID_BUTTON_MINUS:
buttonText ="−";
break;
case ID_BUTTON_MULTIPLY:
buttonText ="*";
break;
case ID_BUTTON_DIVIDE:
buttonText ="/";
break;
case ID_BUTTON_MOD:
buttonText ="%";
break;
case ID_BUTTON_DECIMAL:
buttonText =".";
break;
case ID_BUTTON_CLEAR:
buttonText ="";
break;
case ID_BUTTON_ENTER:
buttonText ="=";
break;
case ID_BUTTON_TAN:
buttonText = "TAN";
break;
case ID_BUTTON_SIN:
buttonText = "SIN";
break;
case ID_BUTTON_CON:
buttonText = "CON";
break;
case ID_BUTTON_NEGATIVE:
buttonText ="(−)";
break;
case ID_BUTTON_BACKSPACE:
buttonText ="<−";
break;
}
}
textControl−>AppendText(buttonText);
}
void CalFrame::OnClearButtonClick(wxCommandEvent& event)
{
textControl−>Clear();
}
void CalFrame::HandleNumberButton(int num)
{
}
void CalFrame::HandleOpratorButton(char ops)
{
}
void CalFrame::Calculat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To add functions for trigonometric calculations sin cos tan to the provided code for the Vending Mac...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started