OK... so you're basically asking us to do your homework. Basically, the function takes 2 parameters, adds them together, and returns the result. Here's some pseudocode:
sum: number1, number2
{
return number1 + number2
}
And basically if you can't figure that out, you seriously need to do some learning on C++.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
If I remember my calculas correctly (mind you its been over 35 years), problem 1 is asking you to calculate the sum of all the numbers between 0 and some maximum value, that you will probably enter from the keyboard. If that is true, your program will need an integer that accumulates the sum and it will need a loop that counts from 0 to N-1.
I don't recall what the second problem means.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
thank you to joeprogrammer and ancient dragon...to ancient dragon..its right just as you wrote...for the sum symbol...actually its not integer that ll be sum but its data array...
In that case, use the loop counter as index into the array
int array[255];
...
...
sum += array[i];
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
kaka: I don't have my crystle ball with me :mrgreen: , so you will have to post the code and a few of the error messages. Also tell us what compiler and operating system you are using.
Sorry, I'm not into programming calculas formulas. But maybe some of the other smart members can help you with that.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343