C++ Help

Where is mistake on this programs

#include <iostream>
using namespace std;
double sum(int a, int b, int c, int d, int e);
{
int n,m;
double x,y;
cout<<"Variable n,m dhe x:";
cin>>n;
cin>>m;
cin>>x;
y=2*x+4*sum(3,n+2,4,1,4)+sum(4,2*n,6,m,3)+sum(5,n,n+1,n-2,-7);
cout<<"y="<<y<<endl;
return 0;
}

double sum(int a,int b,int c,int d,int e)
{
int i,j; double f=1,
s=0;
for(i=a;i<=b;i++)
{
if(i==c)
{i=i+1;}
else
{
for(j=1;j<=d;j++)
{
f=f*j;
}
s=s+(f+(e*i));
}
}
return s;
}
What error compiler shows you? Which line it pointing to?
Wow your code is way too messy with operators

Anyway what I think the error is as you didn't specified it

In C++ operators they all have a precedence (that means important)
Of which come first

So your brackets in the equations has

(3,n+2,4,1,4)

And two other ones it can't do anything with the three
No matter what this bit will start first as you put the brackets

Edit it by removing the brackets and adjusting the precendence of operators
Can you help in this exam how can I solve i can't send picture to see this exam can you write you email or facebook i will send you this exam I need to solve this function MiiNipaa and Mizfizz
What error compiler shows you? Which line it pointing to?
I still waiting for answer. Aside from missing main() function I do not see any obvious errors.
error C2447: missing function header (old-style formal list?)
Strange. Either way. You are missing main() function. Place it between lines 3 and 4
can you complete this problem i send code
#include <iostream.h>
double fakt( int k);
double shuma(int a, int b, int c, int k, int d, int e);
{
int n,m;
double x,y;
cout<<"Te ipen vlerat e n,m dhe x:";
cin>>n;
cin>>m;
cin>>x;
y=2*x+4*shuma(3,n+2,4,1,4)+shuma(4,2*n,6,m,3)+shuma(5,n,n+1,n-2,-7);
cout<<"Shuma e fituar eshte y="<<y<<endl;
return 0;
};

double shuma(int a,int b,int c, int d,int e)
{
int i,j;
double f,s;
f=1;
s=0;
for(i=a;i<=b;i++)
{
if(i==c)
{i=i+1;}
else
{
for(j=1;j<=d;j++)
{
f=f*j;
}
s=s+(f+(e*i));
}
}
return s;
}
You are missing main() function. Place it between lines 3 and 4
ok try it with main() function try you
MiiniPaa can I send photo of this exam edhe where do I send it
-_- why don't you listen to her

the point of a being a good programmer is try you best to solve it then figure it out

she asking you to put the main in she wont do the home for you plus please format your code nicely

listen to our advice
Ok i send int main() but if i set this int main() the programs set 5 errors without int main() programs set 1 error
The errors without int main() may be coming up because there are problems with your program, not because you don't want int main(). Please repost your changed code with [code] tags, the compiler errors you get, and what you think the problem(s) is/are.
ok i solve it it was problem with int d i forgote to set i done it
Topic archived. No new replies allowed.