Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. struct person
  2. {
  3. char name[20];
  4. int age;
  5. };
  6.  
  7.  
  8. int main()
  9. {
  10. person aPerson;
  11. person *person_ptr;
  12. person_ptr = & aPerson;
  13.  
  14. cout << "Please enter a name: " << endl;
  15. cin >> person_ptr->name;
  16. cout << "Please enter an age: " << endl;
  17. cin >> person_ptr->age;
  18.  
  19. cout << person_ptr->name << endl;
  20. cout << person_ptr->age << endl;
  21. cout << person_ptr << endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement