| | |
what is C++ builder code for sum
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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:
And basically if you can't figure that out, you seriously need to do some learning on C++.
C++ Syntax (Toggle Plain Text)
sum: number1, number2 { return number1 + number2 }
"Technological progress is like an axe in the hands of a pathological criminal."
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.
I don't recall what the second problem means.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
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
C++ Syntax (Toggle Plain Text)
int array[255]; ... ... sum += array[i];
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
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.
Sorry, I'm not into programming calculas formulas. But maybe some of the other smart members can help you with that.
Last edited by Ancient Dragon; Nov 14th, 2006 at 8:42 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
Other Threads in the C++ Forum
- Previous Thread: Font size and layout editing
- Next Thread: Type Conversion of User Input:
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






