hello I am trying to make a program which takes an array of ints as an argument and fills the array with random values in the range of 0 to 1000 but all that's happening is its turning units in to tens for example if I enter 3 it will become 13, if I enter 13 it will become 113 and I am really struggling to find an answer if anybody could be of any help I would be grateful.
other information: it has to have the prototype:
void fillarray( int data[], int n);
//
// Date
#include <iostream>
usingnamespace std; //Tells the compiler that your using the standard namespace
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//function prototypes
void fillarray( int data[], int n);
void display(int data[], int n);
int main()
{
int data1[1]={};
fillarray(data1,1);
display(data1,1);
system ("pause");
return 0; // indicate that program ended successfully
}
void fillarray (int data[], int n)
{
int i;
for (i=0;i<n;i++)
{
cout << "enter value for item "<< (i+1) <<": ";
cin >> data[i];
data[i];
}
}
void display(int data[],int n)
{
for (int i=0;i<n;i++)
{
cout<<"the value of item" << " is "<< (i+1) << data[i] << endl;
}
return ;
}