Hello, please help me I am trying to write program that allows a user to enter 10 numbers, stores in an array and then displays each with it's square (no * no) and cube (no * no * no), I am able to get square but cube in not working, it gives me output my that not cube for the number please help me to solve this also in output I want user input number, square and cube the below is my code.
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const int size = 10;
void square_array (double values [size]);
void read_numbers (double values [size]);
void print_cube_root (double values [size]);
int main(int argc, char *argv[])
{
const int size = 10;
double number;
double values [size];
read_numbers (values);
square_array (values);
print_cube_root (values);
cout << "\n\n";
system("PAUSE");
return EXIT_SUCCESS;
}
void read_numbers (double values [size])
{
int index;
cout << "Enter 10 numbers:\n";
for (index = 0; index < size; index++)
cin >> values [index];
}
void square_array (double values [size])
{
int index;
cout << "\nThe square of the numbers are:\n";
for (index = 0; index < size; index++)
{
values [index] = values [index] * values [index];
cout << "\n\n";
cout << values [index];
}
}
void print_cube_root (double values [size]) //this part is not //worknig
{
int index;
cout << "\n\nThe cube root of the numbers are:\n";
for (index = 0; index < size; index++)
{
values [index] = values [index] * values [index];
cout << "\n\n";
cout << values [index];
}
}