struct Person 
                  
                  
                  { 
                  
                  
                  char name[50]; 
                  
                  
                  int age; 
                  
                  
                  float salary;
                  
                  
                   }; 
                  
                  
                  void displayData(Person); // Function declaration 
                  
                  
                  int main()
                  
                  
                   { 
                  
                  
                  Person p; 
                  
                  
                  
                  
                  
                  cout << "Enter Full name: ";
                  
                  
                  cin.get(p.name,59); 
                  
                  
                  cout << "Enter age: ";
                  
                  
                   cin >> p.age;
                  
                  
                   cout << "Enter salary: "; 
                  
                  
                  cin >> p.salary; 
                  
                  
                  
                  
                  
                  /* Function call 
                  
                  
                  with structure variable
                  
                  
                   as an argument 
                  
                  
                  */
                  
                  
                  displayData(p);
                  
                  
                  
                  
                  
                   return 0;
                  
                  
                  }
                  
                  
                   void displayData(Person p) 
                  
                  
                  {
                  
                  
                  cout << "\nDisplaying Information." << endl; 
                  
                  
                  cout << "Name: " << p.name <<endl; 
                  
                  
                  
                  
                  
                  cout <<"Age: " << p.age << endl; 
                  
                  
                  cout << "Salary: " << p.salary;
                  
                  
                   }
                  
                  
                
Оберните код в теги: 3 символа ` до и после кода (в случае одиночной конструкции достаточно 1 ` с обеих сторон). Спасибо!
у тебя массив на 50 элементов а читаешь 59
Обсуждают сегодня