Hi, I am trying by best to code this program which takes user input of ten different numbers and displays it's square and cube, from the below code I can display the square of input numbers but in cube i am having problem please help me solving this.
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const int size = 10;
const int size1 = 10;
void square_array (int values [size]);
void read_numbers (int values [size]);
void cube_array (int values [size1]);
int main(int argc, char *argv[])
{
const int size = 10;
const int size1 = 10;
int values [size];
int i [size];
int a [size1];
read_numbers (values);
square_array (values);
cube_array (values);
cout << "\n\n";
system("PAUSE");
return EXIT_SUCCESS;
}
void read_numbers (int values [size])
{
int index;
cout << "Enter 10 numbers:\n";
for (index = 0; index < size; index++)
cin >> values [index];
}
void square_array (int values [size])
{
int index;
cout << "\nThe square of your input numbers are:\n";
for (index = 0; index < size; index++)
{
values [index] = values [index] * values [index];
cout << "\n\n";
cout << "Square is ---> " << values [index];
}
}
void cube_array ( int values [size1])
{
int index;
cout << "\n\nThe cube root of the numbers are:\n";
for (index = 0; index < size1; index++)
{
values [index] = values [index] * values [index];
cout << "\n\n";
cout << values [index];
}
}
]