Code
#include <iostream>using namespace std;struct student{int roll;char name[20];float marks;};int main(){student s1;student *ptr;ptr = &s1;cout << "Enter the roll number: ";cin >> ptr->roll;cout << "Enter the name: ";cin >> ptr->name;cout << "Enter the marks: ";cin >> ptr->marks;cout << "The details of the student are: " << endl;cout << "Roll number: " << ptr->roll << endl;cout << "Name: " << ptr->name << endl;cout << "Marks: " << ptr->marks << endl;}
Output
Enter the roll number: 142
Enter the name: Tony
Enter the marks: 99
The details of the student are:
Roll number: 142
Name: Tony
Marks: 99
0 Comments
Post a Comment