Advertisement
Guest User

asdfghjkl;'

a guest
Apr 22nd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4.  
  5.  
  6. //struct definition
  7. struct student
  8. {
  9. char name[50];
  10. int age;
  11. float marks;
  12. };
  13. void input(Student &);//function prototype
  14. int main()
  15. {
  16. //var of struct
  17. Student st;
  18.  
  19. //call function
  20. input(st);
  21. }
  22.  
  23. //input data
  24. void input(Student &x)
  25. {
  26. cout << "Please enter name: ";
  27. cin.getline(x.name,50);
  28. cout << "Enter Age : ";
  29. cin >> x.age;
  30. cout << "Enter Marks : ";
  31. cin >> x.marks;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement