I'm trying to implement a structure in C++ 14. I have made a structure that has 3 int
values
struct mystruct{
int a;
int b;
int c;
};
In my main function, I'm initializing a structure array in the following way:
int main(){
mystruct X[] = {{1,2,3}, {4,5,6}};
.
.
}
I'll pass this array to a function where I'll perform some operations on it. That function could be like:
int myfunc(mystruct X[]){
//do something
}
How can I take the values for this array as user input using cin
, instead of hardcoding them (perhaps using objects)? I'm not sure how to go about this.
Edit: I was hoping this could somehow be achieved using objects