help im trying to design a profram that models a simple calculator but is getting error messages that i dont understand

#include<iostream>
#include<cmath>

using namespace std;

void computeResult(float, float, char);
int main()
{
char operation,q;
if(operation!=q)
computeResult(float result0, float input0, char operation0);
else
return("You have ended the session.");
return 0;
}
void computeResult(float result, float input, char operation)
{
cout<<"Enter two numbers and an operation in between "<<endl;
cin>>result>>operation>>input;
switch(operation)
{
case'+': return(result+=input);
break;
case'-': return(result-=input);
break;
case'*': return(result*=input);
break;
case'/': return(result/=input);
break;
case'^': return(pow(result,input));
break;
}
}

the goal of this program is to keep computing using the result from last computation with a newly enter number until the use enter q.

These are the errors I'm getting:
main.cpp:11:16: error: expected primary-expression before ‘float’
computeResult(float result0, float input0, char operation0);
^
main.cpp:11:31: error: expected primary-expression before ‘float’
computeResult(float result0, float input0, char operation0);
^
main.cpp:11:45: error: expected primary-expression before ‘char’
computeResult(float result0, float input0, char operation0);
^
main.cpp:13:41: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]
return("You have ended the session.");
^
main.cpp: In function ‘void computeResult(float, float, char)’:
main.cpp:22:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
case'+': return(result+=input);
^
main.cpp:24:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
case'-': return(result-=input);
^
main.cpp:26:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
case'*': return(result*=input);
^
main.cpp:28:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
case'/': return(result/=input);
^
main.cpp:30:36: error: return-statement with a value, in function returning 'void' [-fpermissive]
case'^': return(pow(result,input));
^
1) You are redeclarin your function again in main(). I supposem you wanted to call it instead. If so, do following: computeResult(float result0, float input0, char operation0);
2) Your function is declared as not returning anything. And you still trying to return something from it.
when putting code here do this...

"["code"]" paste your code here "["/code"]"

without all the quotations obviously

that way your code can be read easily
Topic archived. No new replies allowed.