-
September 5th, 2012, 03:40 AM
#1
i'm stuck HELP, thanks
i want to write a function that can add only -ve numbers from a list of integers. i can declare a function that can add the negative numbers, my problem is how do i get the -ve numbers from a string of both +ve and -ve numbers
int SumOfNumbers(int a, int b){
int result;
result = a+b;
return (result);
}
-
September 5th, 2012, 07:15 AM
#2
Re: i'm stuck HELP, thanks
Please use real words. It took a while to figure out what a -ve number is.
I don't see a string in your code.
-
September 5th, 2012, 09:13 AM
#3
Re: i'm stuck HELP, thanks
this where the problem is, i want to declare a function that captures both negative and positive numbers but adds only the negative numbers in from the input
-
September 5th, 2012, 09:37 AM
#4
Re: i'm stuck HELP, thanks
How about using an array or vector of ints and just testing for < 0.
-
September 5th, 2012, 12:31 PM
#5
Re: i'm stuck HELP, thanks
much help THANKS, I'll notify you when i come up with something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|