The output section only print one state per line. How can i print 3 states per line?
You have mostly answered your own question. If you want to print three per line then tell the program to print three per line. kemont's suggestion is a good start or you might try combining his answer with this:
or include the header file iomanip and use setw() before the variables to set the spacing of the output:
1 2 3
cout << setw(10) << tempo.statename[y] << setw(10) << tempo.admission[y] << setw(10) << tempo.density[y]; // the " " will not be needed when the size of 10 is set correctly.
cout << tempo.statename[y + 1] <<" "<< tempo.admission[y + 1] <<" " << tempo.density[y + 1]; // use the same setw() in this line.
cout << tempo.statename[y + 2] <<" "<< tempo.admission[y + 2] <<" " << tempo.density[y + 2] << endl; // use the same setw() in this line. Use endl only on the last line to keep everything on one line.