Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string.h>
- using namespace std;
- //struct definition
- struct student
- {
- char name[50];
- int age;
- float marks;
- };
- void input(Student &);//function prototype
- int main()
- {
- //var of struct
- Student st;
- //call function
- input(st);
- }
- //input data
- void input(Student &x)
- {
- cout << "Please enter name: ";
- cin.getline(x.name,50);
- cout << "Enter Age : ";
- cin >> x.age;
- cout << "Enter Marks : ";
- cin >> x.marks;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement