Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <iomanip>
- using namespace std;
- float subtotal (float[], int);
- int main() {
- int arraySize;
- cout << "Enter array size: ";
- cin >> arraySize;
- float array[arraySize];
- cout << "Enter an array size of " << arraySize << " : ";
- for (int i=0; i<arraySize; i++){
- cin >> array[i];
- }
- for (int i=0; i<arraySize; i++){
- array [i] = subtotal (array[i], arraySize);
- cout <<left<<setw(5)<< array [i];
- }
- return 0;
- }
- float subtotal (float array, int arraySize){
- float x = array+5;
- return x;
- }
- main.cpp: In function 'int main()':
- main.cpp:30:49: error: cannot convert 'float' to 'float*' for argument '1' to 'float subtotal(float*, int)'
- array [i] = subtotal (array[i], arraySize);
- ^
Add Comment
Please, Sign In to add comment