#include #include #include void dectobi(int p) { int b,i,x,d; for(i=31;i>=0;i--) { d=1<<i; b=p&d; if(b==0) printf("0"); else printf("1"); } } void main() { int i,j,k,ch,n,m,a; char cho; clrscr(); do { printf("enter a integer\n"); scanf("%d",&n); dectobi(n); printf("\n 1 for 1`s compliment"); printf("\n 2 for AND opertion"); printf("\n 3 for OR opertion"); printf("\n 4 for EX-OR opertion"); printf("\n 5 for LEFT SHIFT opertion"); printf("\n 6 for RIGHT SHIFT opertion"); printf("\n 7 for EXIT\n"); scanf("%d",&ch); switch(ch) { case 1: printf(" \n1`s compliment\n"); a=~n; dectobi(a); break; case 2: printf("enter intger\n"); scanf("%d",&m); dectobi(m); printf("after and\n"); a=n&m; dectobi(a); break; case 3: printf("enter intger\n"); scanf("%d",&m); dectobi(m); printf("after OR\n"); a=n|m; dectobi(a); break; case 4: printf("enter intger\n"); scanf("%d",&m); dectobi(m); printf("after EX-OR\n"); a=n^m ; dectobi(a); break; case 5: printf("enter the no by u want to LEFT SHIFT"); scanf("%d",&m); a=n<<m; printf("after LEFT SHIFT\n"); a=n<<1; dectobi(a); break; case 6: printf("enter the no by u want to RIGHT SHIFT"); scanf("%d",&m); a=n>>m; printf("after RIGHT SHIFT\n"); dectobi(a); break; case 7: exit(0); } flushall(); printf("\nwant to continue (y/n)"); scanf("%c",&cho); } while(cho!='n'); }
Computer Graphics
Friend Function Implementation using C++
#include #include
#include
#include
int i=0;
int idno;
class student
{
public:
friend void issue ();
friend void ret ();
};
class lib
{
char name[10];
int roll;
public:
int status;
lib();
void idinfor();
friend void issue ();
friend void ret ();
};
lib::lib()
{
status=0;
}
void lib::idinfor()
{
i++;
cout<<“\n\n\t\t ENTER UR NAME…”;
gets(name);
cout<<“\n\n\t\t ENTER UR ROLL NO…”;
cin>>roll;
cout<<“\n\n\t\t UR ID NUMBER IS….”<<i+1998;< p=””>
}
void issue(int status)
{
int bn;
cout<<“\n\n\t\t LIST OF AVAILABLE BOOKS FOR U”;
cout<<“\n\n\t\t PRESS 1 BALA\n\t\t PRESS 2 VENU\n\t\t PRESS 3 OOPS\n\t\t PRESS 4 MAT”;
cout<<“\n\n\t\t ENTER UR CHOICE”;
cin>>bn;
if(status<3)
{
cout<<“\n\n\t\t BOOK IS AVAILABLE FOR U”;
}
else
{
cout<<“\n\n\t\t BOOK IS NOT AVAILABLE FOR U”;
cout<<“\n\n\t\t U CANT ISSUE MORE THAN TWO BOOKS”;
}
}
void ret()
{
cout<<“\n\n\t\t THANK YOU”;
}
void main()
{
lib l[10];
int ch;
clrscr();
do
{
cout<<“\n\t\t PRESS 1 FOR UR ID NUMBER INFORMATION”;
cout<<“\n\t\t PRESS 2 FOR ISSUE A NEW BOOK “;
cout<<“\n\t\t PREES 3 FOR RETURN A BOOK “;
cout<<“\n\t\t PRESS 4 FOR EXIT”;
cout<<“\n\t\t ENTER UR CHOICE…”;
cin>>ch;
switch(ch)
{
case 1:
clrscr();
l[i].idinfor();
break;
case 2:
clrscr();
cout<<“\n\n\t\tENTER UR ID NO…”;
cin>>idno;
issue(l[i].status);
l[i].status++;
break;
case 3:
clrscr();
cout<<“\n\n\t\tENTER UR ID NO…”;
cin>>idno;
ret();
l[i].status–;
break;
case 4:
exit(0);
break;
}
}while(ch!=4);
}
Cricket Database project using C++
Cricket Database project using C++
Cricket Database project Source Code
#include
#include
#include
#include
#include
#include #include
#include
#include
/*------------------base class------------------------------*/
class player
{
float strate,btavg,blavg;
int runs,wic,hiscr,bbol,overs,balls,innings,r1,w1,o1,b1,hcen,cen,i1;
public:
int mat;
char name[10];
char country[10];
player();
void getdata();
void update();
void showdata();
void calculation();
void search();
void modify();
void updatetest();
void menu();
};
/*----------------------constructor------------------------------*/
player::player()
{
strcpy(name," ");
strcpy(country," ");
strate=0;
btavg=0;
innings=0;
balls=0;
overs=0;
blavg=0;
runs=0;
wic=0;
mat=0;
hiscr=0;
bbol=0;
cen=0;
hcen=0;
}
/* -----------------------------fun for calculation -----------*/
void player::calculation()
{
strate=(float)(runs/balls)*100;
btavg=(float)runs/innings;
blavg=(float)overs/wic;
}
/*---------------------- scan data from user -----------------*/
void player::getdata()
{
cleardevice();
settextstyle(1,0,1);
outtextxy(100,50," ENTER DATA ");
settextstyle(0,0,1);
//cout<<"\n\t\t ENTER INFORMATION: \n\n";
cout<<"\n\n\n\t\t Name: ";
gets(name);
cout<<"\n\t\t Country: ";
gets(country);
cout<<"\n\t\t Matches: ";
cin>>mat;
cout<<"\n\t\t Innings: ";
cin>>innings;
cout<<"\n\t\t Runs: ";
cin>>runs;
cout<<"\n\t\t Balls Played: ";
cin>>balls;
cout<<"\n\t\t Fifties: ";
cin>>hcen;
cout<<"\n\t\t Hundreds: ";
cin>>cen;
cout<<"\n\t\t Overs Bowled: ";
cin>>overs;
cout<<"\n\t\t Wickets: ";
cin>>wic;
cout<<"\n\t\t Best Batting Performance: ";
cin>>hiscr;
cout<<"\n\t\t Best Bowling Performance: ";
cin>>bbol;}
/*-------------- fun used for modification -----------------*/
void player::update()
{
//cout<<"\n\n\t\t ENTER DATA OF LAST MATCH\n";
cleardevice();
settextstyle(1,0,1);
outtextxy(100,50," ENTER DATA OF LAST MATCH");
settextstyle(0,0,1);
cout<<"\n\n\n\t\t Runs: ";
cin>>r1;
if(r1>100)
cen++;
if(r1>50&&r1<100)
hcen++;
runs+=r1;
cout<<"\n\t\t Wickets: ";
cin>>w1;
wic+=w1;
mat++;
cout<<"\n\t\t OUT/NOTOUT(y/n): ";
char ch=getche();
if(ch=='y')
innings++;
cout<<"\n\t\t Overs Bowled :";
cin>>o1;
overs+=o1;
cout<<"\n\t\t Balls Played";
cin>>b1;
balls+=b1;
if(hiscr<r1)
hiscr=r1;
if(bbol<w1)
bbol=w1;
}
/*--------------------- fun for displaying the data --------------*/
void player::showdata()
{
int x=50;
char str[20];
cleardevice();
rectangle(50,150,610,250);
line(50,200,610,200);
for(int i=0;i<6;i++)
{
x+=80;
line(x,150,x,250);
}
outtextxy( 60,170,"MATCHS");
outtextxy(140,170,"RUNS");
outtextxy(220,170,"WICKETS");
outtextxy(300,170,"AVG(BAT)");
outtextxy(380,170,"AVG(BOL)");
outtextxy(460,170,"100`s");
outtextxy(540,170,"50`s");
outtextxy( 50,280,"BEST PERFORMANCE IN A MATCH ::");
outtextxy( 50,300,"RUNS : ");
outtextxy( 50,320,"WICKETS :");
sprintf(str,"%d",mat);
outtextxy(60,220,str);
sprintf(str,"%d",runs);
outtextxy(140,220,str);
sprintf(str,"%d",wic);
outtextxy(220,220,str);
sprintf(str,"%f",btavg);
outtextxy(300,220,str);
sprintf(str,"%f",blavg);
outtextxy(380,220,str);
sprintf(str,"%d",cen);
outtextxy(460,220,str);
sprintf(str,"%d",hcen);
outtextxy(540,220,str);
settextstyle(1,0,1);
sprintf(str,"%s",country);
outtextxy(50,110,str);
sprintf(str,"%s",name);
outtextxy(50,90,str);
settextstyle(0,0,1);
sprintf(str,"%d",hiscr);
outtextxy(130,300,str);
sprintf(str,"%d",bbol);
outtextxy(130,320,str);
getch();
}
fstream file,file1,tfile,tfile1;
int ch1;
/*----------------------------- main -------------*/
void main()
{
player p;
clrscr();
int ch,i=0,gm,gd=DETECT;
char st[10];
int x,y;
x=100;
y=100;initgraph(&gd,&gm,"g:\\tc\\bgi");
char pname[10],cname[10],password[10]="",c;
setbkcolor(BLUE);
while(!kbhit())
{settextstyle(1,0,6);
outtextxy(150,200,"CRICKETER`S");
outtextxy(170,270,"DATABASE");
}
settextstyle(0,0,1);
cleardevice();
setcolor(11);
settextstyle(1,0,1);
outtextxy(100,380,"LOADING...");for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
if(i<400&&i>370)
delay(40);
delay(10);
}
settextstyle(0,0,1);
cleardevice();
getch();
//cleardevice();
/*------------------ starting menu -------*/
int tag;
tag:
cleardevice();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ONE DAY") ;
outtextxy(200,130," 2 :: TEST") ;
//cin>>ch1;ch1=getche();
ch1=ch1-'0';
settextstyle(0,0,1);
if(ch1==1)
{
do
{
cleardevice();
//p.menu();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ADD RECORDS ") ;
outtextxy(200,130," 2 :: MODIFY RECORDS ") ;
outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;
outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;
outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;
outtextxy(200,250," 6 :: BACK") ;
outtextxy(200,280," 7 :: EXIT") ;
//cin>>ch;
ch=getche();
ch=ch-'0';settextstyle(0,0,1);
switch(ch)
{
/*----- ODI insert --------------*/
case 1:cleardevice();
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::end);
p.getdata();
p.calculation();
file.write((char*)&p,sizeof(p));
file.clear();
file.close();
c=getch();
break;
/*------- ODI name wise search -----------*/case 3:
cleardevice();
cout<<"\n\t\t Name For Search: ";
gets(pname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
//if(i>250&&i<300)
// delay(40);delay(10);
}
cleardevice();
int flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\n";
p.showdata();
break;
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;/*-------------- ODI modification --------------*/
case 2:cleardevice();
cout<<"\n\t\tENTER PASSWORD ";
int i=0;
while(i<6)
{
password[i]=getche();
cout<<"*";
i++;
}
getch();
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();if(!strcmp("vineet",password))
{
cout<<"\n\t\t Name For Modification ";
gets(pname);
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file1.open("temp1.txt",ios::in|ios::out|ios::ate);
if(!tfile1)
cout<<"\nerror";
file1.seekp(0,ios::beg);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{if(!strcmp(p.name,pname))
{
flag=1;
p.update();
p.calculation();
file1.write((char*)&p,sizeof(p));
}
else
{
tfile1.write((char*)&p,sizeof(p));
}
}
file.clear();
file.close();
file1.clear();
file1.close();
if(flag==1)
{
remove("ODI.txt");
rename("temp1.txt","ODI.txt");}
if(flag==0)
cout<<"\n\t\t Record Not Found";
}
else
cout<<"\n\t\t Wrong Password";
c=getch();
break;/*------------ ODI country wise search ------*/
case 4:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
//if(i>333&&i<400)
// delay(40);
}
cleardevice();
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
cout<<"\n\n";
p.showdata();
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
/*------ ODI list of players -----------*/
case 5:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
}
cleardevice();
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
settextstyle(1,0,1);
//cout<<"\n\n\t\t"< <p.name;sprintf(st,"%s",p.name);
outtextxy(x,y,st);
y=y+30;
settextstyle(0,0,1);
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
case 6:
goto tag;
//break;case 7:
exit(0);
break;
}
}while(1);
}
if(ch1==2)
{
do
{
cleardevice();
//p.menu();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ADD RECORDS ") ;
outtextxy(200,130," 2 :: MODIFY RECORDS ") ;
outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;
outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;
outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;
outtextxy(200,250," 6 :: BACK") ;
outtextxy(200,280," 7 :: EXIT") ;
//cin>>ch;
ch=getche();
ch=ch-'0';settextstyle(0,0,1);
switch(ch)
{
/*------------------ TEST insert ------------------*/
case 1:
cleardevice();
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::end);
p.getdata();
p.calculation();
tfile.write((char*)&p,sizeof(p));
tfile.clear();
tfile.close();
break;
/*------------------ TEST name wise search ------------------*/
case 3:
cleardevice();
cout<<"\n\t\t Name For Search: ";
gets(pname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
int flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\n";
p.showdata();
break;
}
}
tfile.clear();
tfile.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
c=getch();
break;
/*------------------ TEST modification ------------------*/
case 2:
cleardevice();
cout<<"\n\t\tENTER PASSWORD";
int i=0;
while(i<6)
{
password[i]=getche();
cout<<"*";
i++;
}
getch();
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();if(!strcmp("vineet",password))
{
cout<<"\n\t\t Name For Modification ";
gets(pname);
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile1.open("temp1.txt",ios::in|ios::out|ios::ate);
if(!tfile1)
cout<<"\nerror";
tfile1.seekp(0,ios::beg);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\t\t Enter Data For First Inning: ";
p.update();
cout<<"\n\t\t Enter Data For Second Inning: ";
p.update();
p.mat--;
p.calculation();
tfile1.write((char*)&p,sizeof(p));
}
else
{
tfile1.write((char*)&p,sizeof(p));
}
}
tfile.clear();
tfile.close();
tfile1.clear();
tfile1.close();
if(flag==1)
{
remove("TEST.txt");
rename("temp1.txt","TEST.txt");}
if(flag==0)
cout<<"\n\t\t Record Not Found";
}
else
cout<<"\n\t\t Wrong Password";
c=getch();
break;
/*------------------ TEST country wise search ------------------*/
case 4:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
cout<<"\n\n";
p.showdata();
}
}
tfile.clear();
tfile.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
break;
/*------------------ TEST list ------------------*/
case 5:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
settextstyle(1,0,1);
//cout<<"\n\n\t\t"< <p.name;sprintf(st,"%s",p.name);
outtextxy(x,y,st);
y=y+30;
settextstyle(0,0,1);
//cout<<"\n\n\t\t"< <p.name;
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//char c;
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
case 6:
goto tag;
case 7:
exit(0);
break;
}
}while(1);
}
}
/* ------------------------------end of main -----------------*/#include
#include
#include
#include
#include
#include #include
#include
#include
/*------------------base class--------------------------------*/
class player
{
float strate,btavg,blavg;
int runs,wic,hiscr,bbol,overs,balls,innings,r1,w1,o1,b1,hcen,cen,i1;
public:
int mat;
char name[10];
char country[10];
player();
void getdata();
void update();
void showdata();
void calculation();
void search();
void modify();
void updatetest();
void menu();
};
/*----------------------constructor-------------------------------------*/
player::player()
{
strcpy(name," ");
strcpy(country," ");
strate=0;
btavg=0;
innings=0;
balls=0;
overs=0;
blavg=0;
runs=0;
wic=0;
mat=0;
hiscr=0;
bbol=0;
cen=0;
hcen=0;
}
/* -----------------------------fun for calculation ----------------------*/
void player::calculation()
{
strate=(float)(runs/balls)*100;
btavg=(float)runs/innings;
blavg=(float)overs/wic;
}
/*---------------------- scan data from user -------------------------*/
void player::getdata()
{
cleardevice();
settextstyle(1,0,1);
outtextxy(100,50," ENTER DATA ");
settextstyle(0,0,1);//cout<<"\n\t\t ENTER INFORMATION: \n\n";
cout<<"\n\n\n\t\t Name: ";
gets(name);
cout<<"\n\t\t Country: ";
gets(country);
cout<<"\n\t\t Matches: ";
cin>>mat;
cout<<"\n\t\t Innings: ";
cin>>innings;
cout<<"\n\t\t Runs: ";
cin>>runs;
cout<<"\n\t\t Balls Played: ";
cin>>balls;
cout<<"\n\t\t Fifties: ";
cin>>hcen;
cout<<"\n\t\t Hundreds: ";
cin>>cen;
cout<<"\n\t\t Overs Bowled: ";
cin>>overs;
cout<<"\n\t\t Wickets: ";
cin>>wic;
cout<<"\n\t\t Best Batting Performance: ";
cin>>hiscr;
cout<<"\n\t\t Best Bowling Performance: ";
cin>>bbol;}
/*------------------------------ fun used for modification -----------------*/
void player::update()
{
//cout<<"\n\n\t\t ENTER DATA OF LAST MATCH\n";
cleardevice();
settextstyle(1,0,1);
outtextxy(100,50," ENTER DATA OF LAST MATCH");
settextstyle(0,0,1);
cout<<"\n\n\n\t\t Runs: ";
cin>>r1;
if(r1>100)
cen++;
if(r1>50&&r1<100)
hcen++;
runs+=r1;
cout<<"\n\t\t Wickets: ";
cin>>w1;
wic+=w1;
mat++;
cout<<"\n\t\t OUT/NOTOUT(y/n): ";
char ch=getche();
if(ch=='y')
innings++;
cout<<"\n\t\t Overs Bowled :";
cin>>o1;
overs+=o1;
cout<<"\n\t\t Balls Played";
cin>>b1;
balls+=b1;
if(hiscr<r1)
hiscr=r1;
if(bbol<w1)
bbol=w1;
}
/*------------------------------------- fun for displaying the data -------------*/
void player::showdata()
{
int x=50;
char str[20];
cleardevice();
rectangle(50,150,610,250);
line(50,200,610,200);
for(int i=0;i<6;i++)
{
x+=80;
line(x,150,x,250);
}
outtextxy( 60,170,"MATCHS");
outtextxy(140,170,"RUNS");
outtextxy(220,170,"WICKETS");
outtextxy(300,170,"AVG(BAT)");
outtextxy(380,170,"AVG(BOL)");
outtextxy(460,170,"100`s");
outtextxy(540,170,"50`s");
outtextxy( 50,280,"BEST PERFORMANCE IN A MATCH ::");
outtextxy( 50,300,"RUNS : ");
outtextxy( 50,320,"WICKETS :");
sprintf(str,"%d",mat);
outtextxy(60,220,str);
sprintf(str,"%d",runs);
outtextxy(140,220,str);
sprintf(str,"%d",wic);
outtextxy(220,220,str);
sprintf(str,"%f",btavg);
outtextxy(300,220,str);
sprintf(str,"%f",blavg);
outtextxy(380,220,str);
sprintf(str,"%d",cen);
outtextxy(460,220,str);
sprintf(str,"%d",hcen);
outtextxy(540,220,str);
settextstyle(1,0,1);
sprintf(str,"%s",country);
outtextxy(50,110,str);
sprintf(str,"%s",name);
outtextxy(50,90,str);
settextstyle(0,0,1);
sprintf(str,"%d",hiscr);
outtextxy(130,300,str);
sprintf(str,"%d",bbol);
outtextxy(130,320,str);
getch();
}
fstream file,file1,tfile,tfile1;
int ch1;
/*----------------------------- main ---------------------*/
void main()
{
player p;
clrscr();
int ch,i=0,gm,gd=DETECT;
char st[10];
int x,y;
x=100;
y=100;initgraph(&gd,&gm,"g:\\tc\\bgi");
char pname[10],cname[10],password[10]="",c;
setbkcolor(BLUE);
while(!kbhit())
{settextstyle(1,0,6);
outtextxy(150,200,"CRICKETER`S");
outtextxy(170,270,"DATABASE");
}
settextstyle(0,0,1);
cleardevice();
setcolor(11);
settextstyle(1,0,1);
outtextxy(100,380,"LOADING...");for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
if(i<400&&i>370)
delay(40);
delay(10);
}
settextstyle(0,0,1);
cleardevice();
getch();
//cleardevice();
/*------------------ starting menu -------*/
int tag;
tag:
cleardevice();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ONE DAY") ;
outtextxy(200,130," 2 :: TEST") ;
//cin>>ch1;ch1=getche();
ch1=ch1-'0';
settextstyle(0,0,1);
if(ch1==1)
{
do
{
cleardevice();
//p.menu();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ADD RECORDS ") ;
outtextxy(200,130," 2 :: MODIFY RECORDS ") ;
outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;
outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;
outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;
outtextxy(200,250," 6 :: BACK") ;
outtextxy(200,280," 7 :: EXIT") ;
//cin>>ch;
ch=getche();
ch=ch-'0';settextstyle(0,0,1);
switch(ch)
{
/*----- ODI insert ----------*/
case 1:cleardevice();
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::end);
p.getdata();
p.calculation();
file.write((char*)&p,sizeof(p));
file.clear();
file.close();
c=getch();
break;
/*------- ODI name wise search -------------*/case 3:
cleardevice();
cout<<"\n\t\t Name For Search: ";
gets(pname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
//if(i>250&&i<300)
// delay(40);delay(10);
}
cleardevice();
int flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\n";
p.showdata();
break;
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;/*-------------- ODI modification --------------*/
case 2:cleardevice();
cout<<"\n\t\tENTER PASSWORD ";
int i=0;
while(i<6)
{
password[i]=getche();
cout<<"*";
i++;
}
getch();
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();if(!strcmp("vineet",password))
{
cout<<"\n\t\t Name For Modification ";
gets(pname);
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file1.open("temp1.txt",ios::in|ios::out|ios::ate);
if(!tfile1)
cout<<"\nerror";
file1.seekp(0,ios::beg);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{if(!strcmp(p.name,pname))
{
flag=1;
p.update();
p.calculation();
file1.write((char*)&p,sizeof(p));
}
else
{
tfile1.write((char*)&p,sizeof(p));
}
}
file.clear();
file.close();
file1.clear();
file1.close();
if(flag==1)
{
remove("ODI.txt");
rename("temp1.txt","ODI.txt");}
if(flag==0)
cout<<"\n\t\t Record Not Found";
}
else
cout<<"\n\t\t Wrong Password";
c=getch();
break;/*------------ ODI country wise search --------------*/
case 4:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
//if(i>333&&i<400)
// delay(40);
}
cleardevice();
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
cout<<"\n\n";
p.showdata();
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
/*------ ODI list of players ------------*/
case 5:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
}
cleardevice();
flag=0;
file.open("ODI.txt",ios::in|ios::out|ios::ate);
file.seekp(0,ios::beg);
while(file.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
settextstyle(1,0,1);
//cout<<"\n\n\t\t"< <p.name;sprintf(st,"%s",p.name);
outtextxy(x,y,st);
y=y+30;
settextstyle(0,0,1);
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
case 6:
goto tag;
//break;case 7:
exit(0);
break;
}
}while(1);
}
if(ch1==2)
{
do
{
cleardevice();
//p.menu();
settextstyle(1,0,2);
outtextxy(200,100," 1 :: ADD RECORDS ") ;
outtextxy(200,130," 2 :: MODIFY RECORDS ") ;
outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;
outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;
outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;
outtextxy(200,250," 6 :: BACK") ;
outtextxy(200,280," 7 :: EXIT") ;
//cin>>ch;
ch=getche();
ch=ch-'0';settextstyle(0,0,1);
switch(ch)
{
/*------------------ TEST insert ------------------*/
case 1:
cleardevice();
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::end);
p.getdata();
p.calculation();
tfile.write((char*)&p,sizeof(p));
tfile.clear();
tfile.close();
break;
/*------------------ TEST name wise search ------------------*/
case 3:
cleardevice();
cout<<"\n\t\t Name For Search: ";
gets(pname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
int flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\n";
p.showdata();
break;
}
}
tfile.clear();
tfile.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
c=getch();
break;
/*------------------ TEST modification ------------*/
case 2:
cleardevice();
cout<<"\n\t\tENTER PASSWORD";
int i=0;
while(i<6)
{
password[i]=getche();
cout<<"*";
i++;
}
getch();
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();if(!strcmp("vineet",password))
{
cout<<"\n\t\t Name For Modification ";
gets(pname);
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile1.open("temp1.txt",ios::in|ios::out|ios::ate);
if(!tfile1)
cout<<"\nerror";
tfile1.seekp(0,ios::beg);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{if(!strcmp(p.name,pname))
{
flag=1;
cout<<"\n\t\t Enter Data For First Inning: ";
p.update();
cout<<"\n\t\t Enter Data For Second Inning: ";
p.update();
p.mat--;
p.calculation();
tfile1.write((char*)&p,sizeof(p));
}
else
{
tfile1.write((char*)&p,sizeof(p));
}
}
tfile.clear();
tfile.close();
tfile1.clear();
tfile1.close();
if(flag==1)
{
remove("TEST.txt");
rename("temp1.txt","TEST.txt");}
if(flag==0)
cout<<"\n\t\t Record Not Found";
}
else
cout<<"\n\t\t Wrong Password";
c=getch();
break;
/*------------------ TEST country wise search -------*/
case 4:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
cout<<"\n\n";
p.showdata();
}
}
tfile.clear();
tfile.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
break;
/*------------------ TEST list --------*/
case 5:
cleardevice();
cout<<"\n\t\t Country`s Name For Search: ";
gets(cname);
cleardevice();
setcolor(10);
outtextxy(100,380,"LOADING...");
for(i=0;i<401;i++)
{
outtextxy(100+i,400,"#");
delay(10);
if(i>350&&i<400)
delay(40);
}
cleardevice();
flag=0;
tfile.open("TEST.txt",ios::in|ios::out|ios::ate);
tfile.seekp(0,ios::beg);
while(tfile.read((char*)&p,sizeof(p)))
{
if(!strcmp(p.country,cname))
{
flag=1;
settextstyle(1,0,1);
//cout<<"\n\n\t\t"< <p.name;sprintf(st,"%s",p.name);
outtextxy(x,y,st);
y=y+30;
settextstyle(0,0,1);
//cout<<"\n\n\t\t"< <p.name;
}
}
file.clear();
file.close();
if(flag==0)
cout<<"\n\t\t Record Not Found";
//char c;
//cout<<"\n\n\t\t Enter Any Key To Cont.";
//cin>>c;
c=getch();
break;
case 6:
goto tag;
case 7:
exit(0);
break;
}
}while(1);
}
}
/* ------------------------------end of main ----------*/
Exception Handling in C++ Language
Exception Handling in C++ Language
Create a class named Television that has data members to hold the model number and the screen size in inches,and the price for Exception Handling in C++ program.Member functions include overloaded insertion and extraction operators.If more than four digits are entered for the model,if the screen size is smaller than 12 or greater than 70 inches, or if the price is negative or over $5000 then throw an integer.
Write a main() function that instantiates a television object,allows user to enter data and displays the data members .If an exception is caught ,replace all the data member values with zero values .
Exception Handling in C++ Code
#include #include void test(int,int,int); class television { public: int mod_no,price,size; void operator<<(telivision a) { cout<<"\n\t## INPUT ##"; cout<<"\n\tENTER THE MODEL NO.:"; cin>>mod_no; cout<<"\n\tENTER THE SIZE:"; cin>>size; cout<<"\n\tENTER THE PRICE:"; cin>>price; test(mod_no,price,size); getch(); } void operator>>(television a) { cout<<"\n\t## DISPLAY ##)"; cout<<"\nMODEL NO.:"<<mod_no<<"\nsize:"<<size<<"\nprice:"<<price; <br=""> getch(); } }; void test(int mod_no,int price,int size) { if(mod_no>=10000) throw(1); if(price>5000) throw(2); if(price<0) throw(3); if(size<12) throw(4); if(size>70) throw(5); } void main() { int ch,i; television n,o; do { cout<<"\n\t##### MAIN MENU #####"; cout<<"\n\t1.INPUT"; cout<<"\n\t2.DISPLAY"; cout<<"\n\t3.EXIT"; cout<<"\n\tENTER UR CHOICE:"; cin>>ch; switch(ch) { case 1: try { n<<o; <br=""> } catch(int i) { if(i==1) cout<<"\nMODEL NO IS NOT CORRECT"; else if(i==2) cout<<"\nPRICE IS NOT CORRECT"; else if(i==3) cout<<"\nPRICE IS NEGATIVE"; else if(i==4) cout<<"\nSIZE IS VERY SMALL"; else if(i==5) cout<<"\nSIZE IS VERY LARGE"; n.mod_no=0; n.price=0; n.size=0; } getch(); break; case 2: n>>o; getch(); break; case 3: break; } }while(ch!=3); }
Student Database using Virtual functions in C++
Student Database using Virtual functions in C++
Design a base class consisting of the data members such as name of the student,roll number and subject.The derived class consists of the data members subject code,internal assessment and university examination marks.Construct a virtual base class for the item name of the student and roll number.The program should have the facilities.
- Build a master table
- List a table
- Insert a new entry
- Delete old entry
- Edit an entry
- Search for a record
Student Database using Virtual functions in C++Code
#include #include #include #include class assessment; class student { char name[20],sub[20]; int rno,sub_code,in,uni; public: friend assessment; }; class assessment { int internal,uni_marks; public: void menu(); void input(student *S); void display(student *S); int rlno(student *S); void del(student *S); void modify(student *S); }; void assessment::input(student *S) { cout<<"\nEnter name : "; gets(S->name); cout<<"\nEnter Roll no : "; cin>>S->rno; cout<<"\nEnter subject : "; gets(S->sub); cout<<"\nEnter sub code : "; cin>>S->sub_code; cout<<"\nEnter Internal marks : "; cin>>internal; S->in=internal; cout<<"\nEnter University exam marks : "; cin>>uni_marks; S->uni=uni_marks; } void assessment::display(student *S) { cout<<"\n"<rno; cout<<"\t"<name; cout<<"\t"<sub; cout<<"\t"<sub_code; cout<<"\t"<in; cout<<"\t"<uni; } void assessment::menu() { cout<<"\t\t\t"<<"STUDENT DATABASE MANAGENENT"<<endl<<"\n1.create"<<endl; <br=""> cout<<"2.Display"<<endl<<"3.insert"<<endl; <br=""> cout<<"4.Delete"<<endl<<"5.modify"; <br=""> cout<<endl<<"6.search"<<endl<<"7.exit"; <br=""> } int assessment::rlno(student *S) { return (S->rno); } void assessment ::modify(student *S) { int ch; do { clrscr(); cout<<"EDIT"<<endl<<"1.roll no"<<endl<<"2.name";="" <br=""> cout<<endl<<"3.subject"<<endl<<"4.sub code"<<endl<<"5.int="" assesment";="" <br=""> cout<<endl<<"6.uni exam"<<endl<<"7.exit";="" <br=""> cin>>ch; switch(ch) { case 1: cout<<endl<<"new roll="" no="" :="" ";="" <br=""> cin>>S->rno; break; case 2: cout<<endl<<"new name="" :="" ";="" <br=""> gets(S->name); break; case 3: cout<<endl<<"new subject="" :="" ";="" <br=""> cin>>S->sub; break; case 4: cout<<endl<<"new code="" :="" ";="" <br=""> cin>>S->sub_code; break; case 5: cout<<endl<<"new int="" assessment="" :="" ";="" <br=""> cin>>internal; break; case 6: cout<<endl<<"new university="" marks="" :="" ";="" <br=""> cin>>uni_marks; break; case 7: break; default: cout<<"Invalid Choice"; } }while(ch!=7); } void main() { fstream inoutf; ifstream inf; student S; assessment A; int ch,flag=0,ct=0; int r; char c; do { clrscr(); flag=0; A.menu(); cout<<"\n\nEnter your choice : "; cin>>ch; clrscr(); switch(ch) { case 1: inoutf.open("student.txt",ios::out|ios::binary); do { A.input(&S); inoutf.write((char*) &S,sizeof(S)); cout<<"Want to enter again y/n"; cin>>c; }while(c=='y'); inoutf.close(); break; case 2: inf.open("student.txt",ios::in|ios::binary ); inf.seekg(0); cout<<"\nRNo\tName\tSub\tCode\tAsmnt\tMarks"; //while(!inf.eof()) while(inf.read((char*)&S,sizeof(S))) { A.display(&S); } inf.close(); break; case 3: inoutf.open("student.txt",ios::out|ios::binary|ios::app); inoutf.clear(); A.input(&S); inoutf.write((char*)&S,sizeof(S)); inoutf.close(); break; case 4: cout<<"Enter Roll no to be deleted : "; cin>>r; inf.open("student.txt",ios::in|ios:: binary); inoutf.open("temp.txt",ios::in|ios::out|ios::binary|ios::app); inf.seekg(0); while(inf.read((char*) & S,sizeof(S))) { if(r==A.rlno(&S)) { flag=1; //break; } else { inoutf.write((char*)&S,sizeof(S)); } } if(flag!=1) cout<<"\n\nRoll no not found"; else cout<<"\n\nDeleted"; inf.close(); inoutf.close(); remove("student.txt"); rename("temp.txt","student.txt"); break; case 5: ct=0; cout<<"Enter Roll no to be modified : "; cin>>r; inoutf.open("student.txt",ios::in|ios:: binary|ios::out); inoutf.seekg(0); while(inoutf.read((char*) & S,sizeof(S))) { if(r==A.rlno(&S)) { flag=1; break; } ct++; } if(flag!=1) cout<<"\n\nRoll no not found"; else { ct=ct*sizeof(S); inoutf.seekg(ct,ios::beg); A.modify(&S); inoutf.write((char*)&S,sizeof(S)); } inoutf.close(); break; case 6: inf.open("student.txt",ios::in |ios::binary ); inf.seekg(0); cout<<"Enter Roll no to be searched : "; cin>>r; //while(!inf.eof()) while(inf.read((char*)&S,sizeof(S))) { if(r==A.rlno(&S)) { flag=1; break; } else flag=0; } if(flag==1) { cout<<"\n\nRecord found"; cout<<"\nRNo\tName\tSub\tCode\tAsmnt\tMarks"; A.display(&S); } else cout<<"\nRecord not found"; inf.close(); case 7: break; default: cout<<"Invalid dirn"; } getch(); }while(ch!=7); inoutf.close(); }
Matrix Operations in C Language
Matrix Operations in C Language
- Addition with arrays.
- Multiplication without pointers to arrays
- Transpose with arrays
- Saddle point without pointers to arrays
Matrix Operations in C Code
#include #include template class matrix { public: T mat[10][10]; int i; matrix() { cout<<"\n\tMATRIX IS:"; for(i=0;i<m;i++) <br=""> for(j=0;j<n;j++) <br=""> mat[i][j]=0; } matrix(int m,int n) { cout<<"\n\tMATRIX IS:"; for(int i=0;i<m;i++) <br=""> for(int j=0;j<n;j++) <br=""> cin>>mat[i][j]; } void display(int m,int n) { for(int i=0;i<m;i++) <br=""> { cout<<"\n"; for(int j=0;j<n;j++) <br=""> { cout<<"\t"; cout<<mat[i][j]; <br=""> } } getch(); } }; template void add(T1 mat1,T2 mat2,int r,int c) { int i,j; float mat[20][20]; for(i=0;i<r;i++) <br=""> { for(j=0;j<c;j++) <br=""> { mat[i][j]=mat1[i][j]+mat2[i][j]; } } disp_res(mat,r,c); getch(); } template void disp_res(T mat,int m,int n) { for(int i=0;i<m;i++) <br=""> { cout<<"\n"; for(int j=0;j<n;j++) <br=""> { cout<<"\t"; cout<<mat[i][j]; <br=""> } } getch(); } template void sub(T1 mat1,T2 mat2,int r,int c) { int i,j; float mat[20][20]; for(i=0;i<r;i++) <br=""> { for(j=0;j<c;j++) <br=""> { mat[i][j]=mat1[i][j]-mat2[i][j]; } } disp_res(mat,r,c); getch(); } template void mul(T1 mat1,T2 mat2,int r,int c,int a) { int i,j,k; float mat[10][10]; for(i=0;i<r;i++) <br=""> { for(j=0;j<a;j++) <br=""> { mat[i][j]=0; for(k=0;k<c;k++) <br=""> mat[i][j]+=mat1[i][k]*mat2[k][j]; } } disp_res(mat,r,a); getch(); } template void trans(T mat,int m,int n) { int i,j; T t; if(m>=n) { for(i=0;i<m;i++) <br=""> { for(j=0;j<i;j++) <br=""> { t[i][j]=mat[i][j]; mat[i][j]=mat[j][i]; mat[j][i]=t[i][j]; } } disp_res(mat,n,m); } else { for(i=0;i<n;i++) <br=""> { for(j=0;j<i;j++) <br=""> { t[i][j]=mat[i][j]; mat[i][j]=mat[j][i]; mat[j][i]=t[i][j]; } } disp_res(mat,m,n); } getch(); } void main() { int ch,r,c,ch1; matrixt3(); do { clrscr(); cout<<"\n\t##### MATRIX OPERATIONS ######" <<"\n\t1.INPUT" <<"\n\t2.DISPLAY" <<"\n\t3.ADDITION" <<"\n\t4.SUBTRACTION" <<"\n\t5.MULTIPLICATION" <<"\n\t6.TRANSPOSE" <<"\n\t7.EXIT"; cout<<"\n\tENTER UR CHOICE:"; cin>>ch; switch(ch) { case 1: cout<<"\n\tENTER NO. OF ROWS:"; cin>>r; cout<<"\n\tENTER NO. OF COLUMNS:"; cin>>c; matrixt1(r,c); matrixt2(r,c); break; case 2: do { cout<<"\n\t#### DISPLAY MENU ####"; cout<<"\n\t1.1st MATRIX"; cout<<"\n\t2.2nd MATRIX"; cout<<"\n\t3.EXIT"; cout<<"\n\tENTER UR CHOICE:"; cin>>ch1; clrscr(); switch(ch1) { case 1: cout<<"\n\t1st MATRIX"; t1.display(r,c); break; case 2: cout<<"\n\t2nd MATRIX"; t2.display(r,c); break; case 3: break; } }while(ch1!=3); break; case 3: cout<<"\n\tADDITION IS:"; add(t1.mat,t2.mat, r,c); break; case 4: cout<<"\n\tSUBTRACTION IS:"; sub(t1.mat,t2.mat, r,c); break; case 5: cout<<"\n\tMULTIPLICATION IS:"; mul(t1.mat,t2.mat, r,c,r); break; case 6: do { cout<<"\n\t#### TRANSPOSE MENU ####"; cout<<"\n\t1.1st MATRIX"; cout<<"\n\t2.2nd MATRIX"; cout<<"\n\t3.EXIT"; cout<<"\n\tENTER UR CHOICE:"; cin>>ch1; clrscr(); switch(ch1) { case 1: cout<<"\n\tTRANSPOSE OF 1st MATRIX:"; trans(t1.mat,r,c); trans(t1.mat,r,c); break; case 2: cout<<"\n\tTRANSPOSE OF 2nd MATRIX:"; trans(t2.mat,r,c); trans(t2.mat,r,c); break; case 3: break; } }while(ch1!=3); break; case 7: break; } }while(ch!=7); }