Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ program

Name: Anonymous 2010-11-09 13:33

In C++, write a program that declares an array named myArray with 8 components of the type double. Initialize the array to 8 values that the user will input. Finally, pass the array as a parameter to a new function called printAllElements. This function will display values of each element in the array. You must use a separate function to print the elements.

Name: Anonymous 2010-11-09 14:55

Well, fuck me

Something like this.

[m]
#include <stdio.h>

double *inputDoubles(){
    char stack[1000];
    double i[8];
    char is_safe[1000];
  
    for(int myArray=1;myArray<=8;myArray++){
        printf("  ");
        scanf("%lf",&myArray[i]);
    }
  
    return i;
}

void printDoubles(double *myArray){
    for(int i=1;i<=8;i)
        printf("  %lf\n",i++[myArray]);
}

int main(){
    double *myArray;
  
    printf("Please input 8 numbers:\n");
    myArray=inputDoubles();
  
    printf("You entered:\n");
    printDoubles(myArray);
  
    return 1;
}
[/m]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List