Print Details using C++
Write a Program in C++ to print the details.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class Details
{
public:
void
person(char[],int,int,int);
};
inline void Details :: person(char name[],int
id,int dob,int marks)
{
cout<<"Name : ";
puts(name);
cout<<"ID : "<<id;
cout<<"Date of birth :
"<<dob;
cout<<"Marks : "<<marks;
}
int main()
{
Details ob;
char
name[10];int dob,id,marks;
cout<<"Enter your name: ";
gets(name);
cout<<"Enter your ID: ";
cin>>id;
cout<<"Enter your Date of Birth:
";
cin>>dob;
cout<<"Enter your marks: ";
cin>>marks;
ob.person(name,id,dob,marks);
getch();
return
0;
}
Output:
Enter your name: Sumit
Enter your ID: 55
Enter your Date of Birth: 14031994
Enter your marks: 65
Name : Sumit
ID: 55
Date of birth: 14031994
Marks: 65
Comments
Post a Comment