i have to write a function called scaleData that accepts an array of doubles and a double named scaleFactor. The function must multiple each element of data by the scaleFactor which must be non-zero. if the scale factor in non-zero, return 0; otherwise return 1 (an error code of sorts)
double scaleData( int scaleFactor, int arraySize)
{
double sum = 0;
for (int i = 0; i < arraySize; i++)
sum = sum*scaleFactor;
return 0;
}
this is what i have help me correct this please
Note the example above is pseudeo-code - that is it is written so a human being can follow the idea, the high-level structure, but the actual C++ code will look a bit different.
Well, if you don't mind my saying so, the best way to clear the confusion is to type your best attempt at the code into your editor, then compile and run it, and see what sort of results it gives. Then come back with your further questions depending upon how it works out.