fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. struct person
  5. {
  6. std::string firstName;
  7. std::string middleName;
  8. std::string lastName;
  9. std::string streetAddress1;
  10. std::string streetAddress2;
  11. std::string city;
  12. std::string state;
  13. std::string zip;
  14. };
  15.  
  16. void PrintPersonWithStream(const person& p)
  17. {
  18. std::cout
  19. << "First Name: " << p.firstName << "\n"
  20. << "Middle Name: " << p.middleName << "\n"
  21. << "Last Name: " << p.lastName << "\n"
  22. << "Street Address 1: " << p.streetAddress1 << "\n"
  23. << "Street Address 2: " << p.streetAddress2 << "\n"
  24. << "City: " << p.city << "\n"
  25. << "State: " << p.state << "\n"
  26. << "Zip: " << p.zip << "\n";
  27. }
  28.  
  29. int main()
  30. {
  31. person me{
  32. "Benjamin",
  33. "Eugene",
  34. "Key",
  35. "12343 Some Street",
  36. "Apt 826",
  37. "Austin",
  38. "Texas",
  39. "78729"
  40. };
  41. PrintPersonWithStream(me);
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
First Name: Benjamin
Middle Name: Eugene
Last Name: Key
Street Address 1: 12343 Some Street
Street Address 2: Apt 826
City: Austin
State: Texas
Zip: 78729