#include #include #include #include using namespace std; int main() { passwd * user; bool gotOne = false; user= getpwent(); while (user != NULL) { cout << user->pw_name << ":"<< user->pw_uid << endl; gotOne = true; user= getpwent(); } if (gotOne) { cout << endl; cout << "Starting over " << endl; setpwent(); } else { perror("getpwent: "); return 1; } user= getpwent(); cout << "The first field is " << user->pw_name << " " << user->pw_gecos << endl; endpwent(); return 0; }