Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help me with stack calculator

Status
Not open for further replies.

anglin1024

Newbie level 2
Joined
May 1, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
if I want to write the equation:68*(88/11+37-7)+log(35)+cos(60)+3^2
can anyone write the c code for this calculator for me?
 

Code:
#include <math.h>

/*--- Function ptototype ---*/

double calculate(double V1, double V2, double V3, double V4, double V5,
									double V6, double V7, double V8, double V9);

/*--- Program entry ---*/

int _tmain(void)
	{
	double answer;
	double V1 = 68.0;
	double V2 = 88.0;
	double V3 = 11.0;
	double V4 = 37.0;
	double V5 = 7.0;
	double V6 = 35.0;
	double V7 = 35.0;
	double V8 = 3.0;
	double V9 = 2.0;

	answer = calculate(V1, V2, V3, V4, V5, V6, V7, V8, V9);
	return 0;
	}

/*--- Calculation ---*/

double calculate(double V1, double V2, double V3, double V4, double V5,
									double V6, double V7, double V8, double V9)
	{
	return (V1 * (V2 / V3 + V4 - V5) + log10(V6) + cos(V7) + pow(V8, V9));
	}

/*--- End of File ---*/
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top