fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. const int con = 1e9;
  4. #define YES cout << "YES\n"
  5. #define NO cout << "NO\n"
  6. #define Yes cout << "Yes"
  7. #define No cout << "No"
  8. using namespace std;
  9. struct Person
  10. {
  11. char name[50];
  12. int age;
  13. float salary;
  14. };
  15. Person inputAndDisplay()
  16. {
  17. Person p;
  18. cin >> p.name >> p.age >> p.salary;
  19. cout << "Displaying Information." << endl;
  20. cout << "Name: " << p.name << endl;
  21. cout << "Age: " << p.age << endl;
  22. cout << "Salary: " << p.salary << endl;
  23. return p;
  24. }
  25. void displayData(Person p)
  26. {
  27. cout << "Displaying Information." << endl;
  28. cout << "Name: " << p.name << endl;
  29. cout << "Age: " << p.age << endl;
  30. cout << "Salary: " << p.salary << endl;
  31. }
  32. int main () {
  33. inputAndDisplay();
  34. Person p ;
  35. cin>>p.name>>p.age>>p.salary;
  36. displayData(p);
  37. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Displaying Information.
Name: 
Age: 21922
Salary: -1.26156e-32
Displaying Information.
Name: 
Age: 21922
Salary: -1.26156e-32