I'm having trouble using structs to program. I want to accept input in the form of (integer, character) which can repeat several times. The program will then store the character in the array in the spot where the integer indicates. Currently, the issue is that Message is undefined and that location is undefined.
struct MessagePiece
{
int location;
char message;
};
void readMessage( istream& in, Message message[] )
{
MessagePiece;
message[256];
Message message;
while ( !in.fail() )
{
in >> location; //I'm not sure why this counts as undefined as it is defined in the struct
if (location < 256, location >= 0)
in >> message[location];
}
return;
};