Calling of a function

22:41 0 Comments A+ a-

Problem:
Write a program that should have a function display() and this function should display your name and roll number on the screen. Call this function from main observe output..
Solution Code:
# include <iostream>
using namespace std;
void display();
int main()
{
display();

system("pause");
}
void display()
{
char name[50];
char rollNo[11];
cout<<"PLease Enter your Name : ";
cin.getline(name,50);
cout<<"Please Enter your Roll Number : ";
cin.getline(rollNo,11);
cout<<"Your Name is "<<name<<" and Your Roll Number is "<<rollNo<<endl;


}