How can I use my function output_integer for the array v, without making a new function? I need to print the values that end up in v, but i want to use the same function as i do for m:
#include <iostream>
#include <cmath>
using namespace std;
int m[10];
int v[10];
void input_integer()
{
for (int i=0; i<10; i++)
{
cout<<"Element "<<i+1<<"=";
cin>>m[i];
}
}
void output_integer()
{
cout<<"The values of the array are:\n";
for (int i=0; i<10; i++)
{
cout<<"Element "<<i+1<<" = "<<m[i]<<"\n";
}
}
void copy_div3()
{
int k=0;
for (int i=0; i<10; i++)
{
if (m[i]%3==0)
{
v[k]=m[i];
k++;
}
}
}
int main()
{
//input_integer();
output_integer();
copy_div3();
return 0;
}