I know this seems like a dumb question but it's been some time since I've worked with programming and I had a simple array question. I was wondering how I can fill this empty array with squared numbers corresponding to the original num_List array.
Is this right at all?
Also do the square and cubed functions not work with arrays?
Code:
// ***************************************
//Doug Miller
//Programming Assignment 1, Program 1
//Square and cube examples
//****************************************
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
#define MAX 10
int num_List [MAX] =
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int square_Nums[MAX] = {0};
int cubed_Nums[MAX] = {0};
using namespace std;
int main()
{
//Declarations
int i =0;
int squared_Term = 0;
for (i = 0; i < MAX;)
{
square_Nums[i] = (num_List[i] * num_List[i]);
i++;
}
//Gather input
//Make calcuations
//Display output
/* int p =0;
for (i = 0; i < MAX;)
{
cout << square_Nums[p] << std::endl;
p++;
}
*/
return 0;
std::cin.get();
}//END OF MAIN