<div>#include<stdio.h><br>float docalculate(char opertor,float operandA,float operandB);<br>float doAdd(float operandA,float operandB);<br>float doSub(float operandA,float operandB);<br>float doMul(float operandA,float operandB);<br>float doDiv(float operandA,float operandB);</div> <div>int mian()<br>{<br> float result=0;</div> <div> result=docalculate('+',10.0,20);<br> printf("10+20=%f\n",result);</div> <div> result=docalculate('-',35,19);<br> printf("35-19=%f\n",result);<br> <br> result=docalculate('*',12.3,4.5);<br> printf("12.3x4.5=%f\n",result);<br> <br> result=docalculate('/',100/2.5);<br> printf("100/2.5=%f\n",result);</div> <div> return 0;<br>}</div> <div>float docalculate(char op,float operandA,float operandB)<br>{<br> float(*pcalculate)(float operandA,float operandB);</div> <div> switch(op){<br> case '+': pcalculate=doAdd;break;<br> case '-': pcalculate=doSub;break;<br> case '*': pcalculate=doMul;break;<br> case '/': pcalculate=doDiv;break;<br> };</div> <div> return pcalculate(operandA,operandB);<br>}</div> <div>float doAdd(float operandA,float operandB)<br>{<br> return operandA+operandB;<br>}</div> <div>float doSub(float operandA,float operandB)<br>{<br> return operandA-operandB;<br>}</div> <div>float doMul(float operandA,float operandB)<br>{<br> return operandA*operandB;<br>}</div> <div>float doDiv(float operandA,float operandB)<br>{<br> return operandA/operandB;<br>}</div> <div> </div> <div>이식에서 틀린게 뭔지아시나요 ? ㅠㅠ</div> <div>독학중이라 모르는게 잇어도 제대로 알방법이 없습니다 </div> <div>지적해주는김에 재귀함수에 대한 자세한설명해줄실분잇으신가요 ? ㅠㅠ</div> <div>1>c:\users\administrator\documents\visual studio 2010\projects\e\e\d.cpp(18): warning C4305: '인수' : 'double'에서 'float'(으)로 잘립니다.<br>1>c:\users\administrator\documents\visual studio 2010\projects\e\e\d.cpp(21): error C2660: 'docalculate' : 함수는 2개의 매개 변수를 사용하지 않습니다.</div> <div>이런게 뜨네요 그리고 float함수 결과나올때 소수점 뒷자리수는 왜 안나오는거죠 ?</div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.