i am supposed which accepts a five-digit integer value. my program is then to output the digits, one per line. Each line of output should contain the digit value, its square and its cube.
Once I have the program running correctly, modify the program so that it will process as many values as the user requests. The program should BEGIN by prompting the user for the number of values to be processed.
I am having trouble with the output.
the output should look like this:
How many values will you enter: 3
enter a value: 12345
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
enter a value: 11223
1 1 1
1 1 1
2 4 8
2 4 8
3 9 27
enter a value: 33322
3 9 27
3 9 27
3 9 27
2 4 8
2 4 8
this is what i got so far:
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const int size = 5;
int main()
{
int trials, nums[size], square, cube;
cout << "please enter number of values to be processed:\n";
cin >> trials;
cout << "please enter" << trials << "values:\n";
for (int trial = 1; trial <= trials; trial++)
{
for (int index = 0; index < size; index++)
{
cin >> nums[size];
nums [index] = nums [index] *nums [index];
cout << nums[size] << nums[index];
}
}
return 0;
}