/*
Name: Sean Griffin
Date: October 26th, 006
Description: This code will ask the user for inputs, store those
inputs in an array and regenerate them for the user.
Write code that will ask the user for a number of
inputs. These numbers will be written to an array.
The code will regenerate those numbers back and provide
them to the user.
*/
#include <iostream>
void gen_array(int y[], int x);
void disp_array(int y[], int x);
void main(void)
{
int x; //psuedo-array size
int y[10];
std::cout << "Please insert the number of values you would like" << std::endl;
std::cout << "Please keep this number lower then 10" << std::endl;
std::cin >> x;
gen_array(y,x);
disp_array(y,x);
char c1;
std::cin >> c1;
}
void gen_array(int y[], int x)
{
for(int i=0; i<x; i++)
{
int temp;
std::cout << "Insert a number: " << std::endl;
std::cin >> temp;
y[i]=temp;
}
}
void disp_array(int y[], int x)
{
for(int i=0; i<x; i++)
std::cout << y[i] << ", ";
}
/*
Sample Output
Please insert the number of values you would like
Please keep this number lower then 10
3
Insert a number:
2
Insert a number:
6
Insert a number:
8
The numbers you provided are:
2, 6, 8,
*/