Mar 30, 2012 at 2:30am UTC
i have these errors
header.h(29) : error C2143: syntax error : missing ')' before '}'
header.h(29) : error C2143: syntax error : missing ';' before '}'
\header.h(29) : error C2143: syntax error : missing ';' before '}'
header.h(29) : error C2059: syntax error : '}'
header.h(30) : error C2143: syntax error : missing ';' before '{'
header.h(30) : error C2447: '{' : missing function header (old-style formal list?)
What did i do wrong and how should I fix it.
Header File
#include<iostream>
#include<cmath>
#include<fstream>
#include<string>
using namespace std;
void inst()
{
cout<<"Fractional Arithmetic Program"<<endl<<endl;
cout<<"This program will perform arithmetic on fractions"<<endl;
cout<<"Problems should be entered like this: 4/7 * 3/9"<<endl<<endl;
cout<<"The allowed operations are addition (+), subtraction (-),"<<endl;
cout<<"multipliation (*), and addition (/)."<<endl<<endl;
cout<<"Please enter your problem=> ";
}
void user_Input(int& num1, char& frac1, int& denum1, char& mid, int& num2, char& frac2, int& denum2)
{
}
void multi(int& num1, int& denum1, int& num2, int& denum2)
{
}
void division(int& num1, int& denum1, int& num2, int& denum2}
{
}
MAIN FUNCTION
#include<cmath>
#include<string>
#include<iostream>
#include "header.h"
using namespace std;
int main()
{
int num1=0 , denum1 = 0, num2=0, denum2=0 , p1=0, p2=0;
char frac1= ' ' , mid=' ', frac2=' ';
inst();
user_Input(num1, frac1, denum1, mid, num2, frac2, denum2);
cin>>num1>>frac1>>denum1>>mid>>num2>>frac2>>denum2;
if( mid=='*')
{
multi(num1,denum1,num2,denum2);
p1= num1 * num2;
p2= denum1 * denum2;
cout<<p1<<"/"<<p2;
}
if (mid =='/')
{
division(num1,denum1,num2,denum2);
p1= num1 * denum2;
p2= denum1 * num2;
cout<<p1<<"/"<<p2;
}
system("pause");
return 0;
}
Mar 30, 2012 at 2:35am UTC
void division(int & num1, int & denum1, int & num2, int & denum2}
The error is on this line.
And remember to put your code in code blocks before posting, also what's with all the white space?
Mar 30, 2012 at 11:19pm UTC
sorry about the white space ,
what exactly is wrong on that line you commented about?
Mar 30, 2012 at 11:37pm UTC
Here
void division(int& num1, int& denum1, int& num2, int& denum2}
should be closed parenthesis.
Mar 30, 2012 at 11:53pm UTC
thanks vlad,
but why does it need a closed paranthesis could you please tell me.
Mar 31, 2012 at 12:01am UTC
but why does it need a closed paranthesis could you please tell me.
Because the first line of functions uses () and not {}.
It should look like this
void division(int & num1, int & denum1, int & num2, int & denum2)
and not like this
void division(int & num1, int & denum1, int & num2, int & denum2}
Last edited on Mar 31, 2012 at 12:14am UTC
Mar 31, 2012 at 12:19am UTC
oh yeah thanks I had not seen that error
I feel kind of stupid for not seeing that