Digital Library

#include<iostream>
#include <string.h>
using namespace std;
class library
{
  public:
  char name[20];
  int roll;
  int book_code;
  static int counter;
  library(char n[],int r,int no)
  {
    strcpy(name,n);
    roll=r;
    book_code=no;
  }
  void show()
  {
    cout<<"\nRoll No:"<<roll;
    cout<<"\nName of the Student:"<<name;
    cout<<"\nCode of Book Accessed:"<<book_code;
  }
  void count()
  {
   cout<<counter;
  }
 
};
int main()
{
    char name[20];
    int rollno,code;
    cin>>rollno>>name>>code;
    library lib1(name,rollno,code);
    cin>>rollno>>name>>code;
    library lib2= library(name,rollno,code);
    lib1.show();
    lib2.show();
return 0;
}

3 comments: