Advertisement
Sufyan

Ass 2 prg

Sep 4th, 2011
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.43 KB | None | 0 0
  1. //write a C++ Programe..
  2. #include<iostream.h>
  3. #include<conio.h>
  4. #include<iomanip.h>
  5. class cricket
  6. {
  7.     public:
  8.     char nm[50],cntr[50],t[50];
  9.     int age,tr,tm,tw;
  10.  
  11.     cricket()
  12.     {
  13.     age=tm=tr=tw=0;
  14.     }
  15.     void read();
  16.     void print();
  17. };
  18.     void cricket::read()
  19.     {
  20.  
  21.     cout<<"Enter Name:";
  22.     cin>>nm;
  23.     cout<<"Enter Age:";
  24.     cin>>age;
  25.     cout<<"Enter Country:";
  26.     cin>>cntr;
  27.  
  28.     cout<<"Enter type of Cricketer:";
  29.     cin>>t;
  30.  
  31.     cout<<"Enter Total Match:";
  32.     cin>>tm;
  33.  
  34.     cout<<"Enter Total Runs:";
  35.     cin>>tr;
  36.  
  37.     cout<<"Enter Total Wicket:";
  38.     cin>>tw;
  39.  
  40. }
  41.     void cricket::print()
  42.     {
  43.     cout<<endl<<setw(10)<<nm<<setw(4)<<age<<setw(12)<<cntr<<setw(12)<<tm<<setw(12)<<tr<<setw(15)<<tw;
  44.     }
  45.  
  46.     void main()
  47.     {
  48.     cricket c[50];
  49.     int n,i;
  50.     clrscr();
  51.     cout<<"Enter Number of Cricketer:";
  52.     cin>>n;
  53.  
  54.         for(i=0;i<n;++i)
  55.         {
  56.         c[i].read();
  57.         cout<<endl<<setw(10)<<"Name"<<setw(4)<<"Age"<<setw(12)<<"Country"<<setw(12)<<"Total Match"<<setw(12)<<"Total Runs"<<setw(15)<<"Total Wicket";
  58.  
  59.         cout<<endl<<setw(10)<<"---------"<<setw(4)<<"------"<<setw(12)<<"-------"<<setw(12)<<"------"<<setw(12)<<"-------"<<setw(15)<<"--------";
  60.         c[i].print();
  61.         }
  62.         getch();
  63.             }
  64. //write a C++ Programe..
  65. #include<iostream.h>
  66. #include<conio.h>
  67. #include<iomanip.h>
  68. class cricket
  69. {
  70.     public:
  71.     char nm[50],cntr[50],t[50];
  72.     int age,tr,tm,tw;
  73.  
  74.     cricket()
  75.     {
  76.     age=tm=tr=tw=0;
  77.     }
  78.     void read();
  79.     void print();
  80. };
  81.     void cricket::read()
  82.     {
  83.  
  84.     cout<<"Enter Name:";
  85.     cin>>nm;
  86.     cout<<"Enter Age:";
  87.     cin>>age;
  88.     cout<<"Enter Country:";
  89.     cin>>cntr;
  90.  
  91.     cout<<"Enter type of Cricketer:";
  92.     cin>>t;
  93.  
  94.     cout<<"Enter Total Match:";
  95.     cin>>tm;
  96.  
  97.     cout<<"Enter Total Runs:";
  98.     cin>>tr;
  99.  
  100.     cout<<"Enter Total Wicket:";
  101.     cin>>tw;
  102.  
  103. }
  104.     void cricket::print()
  105.     {
  106.     cout<<endl<<setw(10)<<nm<<setw(4)<<age<<setw(12)<<cntr<<setw(12)<<tm<<setw(12)<<tr<<setw(15)<<tw;
  107.     }
  108.  
  109.     void main()
  110.     {
  111.     cricket c[50];
  112.     int n,i;
  113.     clrscr();
  114.     cout<<"Enter Number of Cricketer:";
  115.     cin>>n;
  116.  
  117.         for(i=0;i<n;++i)
  118.         {
  119.         c[i].read();
  120.         cout<<endl<<setw(10)<<"Name"<<setw(4)<<"Age"<<setw(12)<<"Country"<<setw(12)<<"Total Match"<<setw(12)<<"Total Runs"<<setw(15)<<"Total Wicket";
  121.  
  122.         cout<<endl<<setw(10)<<"---------"<<setw(4)<<"------"<<setw(12)<<"-------"<<setw(12)<<"------"<<setw(12)<<"-------"<<setw(15)<<"--------";
  123.         c[i].print();
  124.         }
  125.         getch();
  126.             }
  127. //write a C++ Programe..
  128. #include<iostream.h>
  129. #include<conio.h>
  130. #include<iomanip.h>
  131. class cricket
  132. {
  133.     public:
  134.     char nm[50],cntr[50],t[50];
  135.     int age,tr,tm,tw;
  136.  
  137.     cricket()
  138.     {
  139.     age=tm=tr=tw=0;
  140.     }
  141.     void read();
  142.     void print();
  143. };
  144.     void cricket::read()
  145.     {
  146.  
  147.     cout<<"Enter Name:";
  148.     cin>>nm;
  149.     cout<<"Enter Age:";
  150.     cin>>age;
  151.     cout<<"Enter Country:";
  152.     cin>>cntr;
  153.  
  154.     cout<<"Enter type of Cricketer:";
  155.     cin>>t;
  156.  
  157.     cout<<"Enter Total Match:";
  158.     cin>>tm;
  159.  
  160.     cout<<"Enter Total Runs:";
  161.     cin>>tr;
  162.  
  163.     cout<<"Enter Total Wicket:";
  164.     cin>>tw;
  165.  
  166. }
  167.     void cricket::print()
  168.     {
  169.     cout<<endl<<setw(10)<<nm<<setw(4)<<age<<setw(12)<<cntr<<setw(12)<<tm<<setw(12)<<tr<<setw(15)<<tw;
  170.     }
  171.  
  172.     void main()
  173.     {
  174.     cricket c[50];
  175.     int n,i;
  176.     clrscr();
  177.     cout<<"Enter Number of Cricketer:";
  178.     cin>>n;
  179.  
  180.         for(i=0;i<n;++i)
  181.         {
  182.         c[i].read();
  183.         cout<<endl<<setw(10)<<"Name"<<setw(4)<<"Age"<<setw(12)<<"Country"<<setw(12)<<"Total Match"<<setw(12)<<"Total Runs"<<setw(15)<<"Total Wicket";
  184.  
  185.         cout<<endl<<setw(10)<<"---------"<<setw(4)<<"------"<<setw(12)<<"-------"<<setw(12)<<"------"<<setw(12)<<"-------"<<setw(15)<<"--------";
  186.         c[i].print();
  187.         }
  188.         getch();
  189.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement