fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct Person {
  6. string name;
  7. int age;
  8. double height;
  9. double weight;
  10. };
  11.  
  12. int main() {
  13. Person peter = {"Peter Jone", 18, 180.5, 70.5};
  14. cout << "Name: " << peter.name << endl;
  15. cout << "Age: " << peter.age << endl;
  16. cout << "Height: " << peter.height << endl;
  17. cout << "weight: " << peter.weight << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 5304KB
stdin
 
stdout
Name: Peter Jone
Age: 18
Height: 180.5
weight: 70.5