I have a question about structures. I'm trying to have the user input a letter and have the the computer return two values. Here's what I have till now:
#include <iostream>
struct coords{
int coordsx1;
int coordsy1;
} a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
int main()
{
char first;
int coordsx1;
int coordsy1;
a.coordsx=0; e.coordsx=0; i.coordsx=0; m.coordsx=0;
b.coordsx=1; f.coordsx=1; j.coordsx=1; n.coordsx=1;
c.coordsx=2; g.coordsx=2; k.coordsx=2; o.coordsx=2;
d.coordsx=3; h.coordsx=3; l.coordsx=3; p.coordsx=3;
cin >> first;
coordsx1= first.coordsx; // this is the part that doesn't work
}
For example if the user inputs 'd' for the variable first, I want the computer to set the value of coordsx1 to be equal to 3 and coordsy1 to be equal to 0 (I haven't done the coordsy1 part yet). Also, is this a good way to return more than one value for a user input?