12345678910111213141516171819202122232425262728293031
#include <iostream> #include <istream> using namespace std; struct employee { int number; char name[20]; float salary; }; int main() { employee em[3]; for (int i = 0; i < 3; i++) { cout << "Enter employee 3 digit number: " << endl; cin >> em[i].number; cout << "Enter employee name: " << endl; cin.getline(em[i].name[20]); cout << "Enter employee salary: " << endl; cin >> em[i].salary; cout << em[i].number << "" << em[i].name << "" << em[i].salary << endl; } system("pause"); return 0; }
cin.getline(em[i].name, 20);
getline
int
name