So I\'ve created a function in c++, but I\'m trying to use a cin input in main i
ID: 3650274 • Letter: S
Question
So I've created a function in c++, but I'm trying to use a cin input in main in that function. How do I run that cin function from main into another function. For example,#include<iostream>
using namespace std;
int getvalue(int a[][col]);
int main()
{
int x;
cin >> row;
cin >> column;
cout << getvalue << endl;
return 0;
int getvalue(int a[][col])
{
int i,j,sum=0;
for(i=0;i<row;i++)
{
for(j=0;j<column;j++)
{
sum+=a[i][j];
}
}
return sum;
}
I've been getting errors while trying to do something like this. I'm just trying to run the cin variable in the function that will spit something back out. I hope it's possible. Please help.