• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

C Business Function

I am trying to write C Business Function first time. I have Data Structure in .h

typedef struct tagDSD5501A3A
{
MATH_NUMERIC mnInput1;
MATH_NUMERIC mnInput2;
MATH_NUMERIC mnOutput;
JCHAR cOperator;
JCHAR szErrorId[11];
JCHAR szErrorMessage[81];
} DSD5501A3A, *LPDSD5501A3A;

I just want to build simple calculator. Please Guide how will it work and is strycpy and Mathcpy required for this operation.

This is my main logic I don't know if it is correct.
if(LPDSD5501A3A->cOperator=='+')
{
LPDSD5501A3A->mnOutput=LPDSD5501A3A->mnInput1+LPDSD5501A3A->mnInput2;
}
else if(LPDSD5501A3A->cOperator=='-')
{
LPDSD5501A3A->mnOutput=LPDSD5501A3A->mnInput1-LPDSD5501A3A->mnInput2;
}
else if(LPDSD5501A3A->cOperator=='*')
{
LPDSD5501A3A->mnOutput=LPDSD5501A3A->mnInput1*LPDSD5501A3A->mnInput2;
}
else if(LPDSD5501A3A->cOperator=='/')
{
LPDSD5501A3A->mnOutput=LPDSD5501A3A->mnInput1/LPDSD5501A3A->mnInput2;
}
 

jdedwardsuser

Active Member
Yes you will have to use API . This kind of add functions does not work in C business . You have to use Mathadd , MathMult, MathDivide and MathSub functions for this
 

BOster

Legendary Poster
Do you have a solid foundation in the C language? Looking at what you posted it doesn't appear that you do. Learn the C language concepts, constructs, design patterns, etc. FIRST, and once you have a very solid understanding of the C language, then learn C BSFNs.
 
Top