Saturday, 17 March 2012

University Management System in C++


#include<iostream.h>
#include<conio.h>                                                                                        
int a=2,b=3,c=4,i=0;
class lib
{
int bookid,n;
public:
void show();
void issue();
void ret();
};
class lib lb;
void lib::issue()
{
cout<<"enter code:";                                                                             
cin>>n;                                                                            
switch(n)
{
case 101:
if(a!=i)
{
a--;
cout<<"morish mano is issued\nno. of books="<<a<<"\n\n";
}
else
cout<<"book is not available in library\n";

break;
case 102:
if(b!=i)
{
b--;
cout<<"peter syckes is issued\n no. of book="<<b<<"\n\n";
}
else
cout<<"book is not available in library\n";
break;
case 103:
if(c!=i)
{
c--;
cout<<"ncert maths is issued\n no. of book="<<c<<"\n\n";
}
else
cout<<"book is not available in library\n";
break;
}
}
void lib::ret()
{
cout<<"enter book code to return the book:";
cin>>n;


switch(n)
{
case 101:
if(a!=2)
{
a++;
cout<<"morish mano is returned\nno. of books="<<a<<"\n";

}
else
cout<<"you have not issued this book\n";
break;
case 102:
if(b!=3)
{
b++;
cout<<"peter syckes is returned\n no. of book="<<b<<"\n";
}
else
cout<<"you have not issued this book\n";
break;
case 103:
if(c!=4)
{
c++;
cout<<"ncert maths is returned\n no. of book="<<c<<"\n";
}
else
cout<<"you have not issued this book\n";
break;
}
}

void lib::show()
{
cout<<"book code:101\n";
cout<<"name: morish mano\n";
cout<<"availability:"<<a<<"\n\n";
cout<<"book code:102\n";
cout<<"name: peter sykes\n";
cout<<"availability:"<<b<<"\n\n";
cout<<"book code:103\n";
cout<<"name: ncert maths\n";
cout<<"availability:"<<c<<"\n\n";
}


class ums
{

int regno,k,n,m;
public:
void library();
void attend();
void result();
void input()
{
cout<<"\t\t\tUNIVERSITY MANAGEMENT SYSTEM\n";
cout<<"START:\n";
cout<<"enter your registration no.";
cin>>regno;
}
void data();
};
void ums::data()
{
int j;
switch(regno)
{
case 11002356:
cout<<"name:Amit"<<"\n";
cout<<"section:K3001"<<"\n";
cout<<"enter [1] to go to library"<<"\n";
cout<<"enter [2] to see attendence"<<"\n";
cout<<"enter [3] to see result"<<"\n";
break;
case 11004567:
cout<<"name:Neeraj"<<"\n";
cout<<"section:K3001"<<"\n";
cout<<"enter [1] to go to library"<<"\n";
cout<<"enter [2] to see attendence"<<"\n";
cout<<"enter [3] to see result"<<"\n";
break;
case 11009096:
cout<<"name:Saurabh"<<"\n";
cout<<"section:K3001"<<"\n";
cout<<"enter [1] to go to library"<<"\n";
cout<<"enter [2] to see attendence"<<"\n";
cout<<"enter [3] to see result"<<"\n";
break;
default:
cout<<"regno. is incorrect\npress [9]";
}

}
void ums::library()
{
x:
cout<<"enter [1] to see available book"<<"\n";
cout<<"enter [2] to issue the book"<<"\n";
cout<<"enter [3] to return the book"<<"\n";
cout<<"press [9] to exit library\n"<<"\n";
cin>>k;
switch(k)
{
case 1:
lb.show();
cout<<"press [0] to go to menu of library\n";
cout<<"press [9] key to exit library\n";
cin>>m;
if(m==0)
goto x;
else
goto y;
case 2:
lb.issue();
cout<<"press [0] to go to  menu of library\n";
cout<<"press [9] key to exit library\n";
cin>>m;
if(m==0)
goto x;
else
goto y;

case 3:
lb.ret();
cout<<"press [0] to go to menu of library\n";
cout<<"press [9] key to exit library\n";
cin>>m;
if(m==0)
goto x;
else
goto y;
}
y:
}
void ums::attend()
{
int regno,phy,cmp,math,pass;
cout<<"enter your regno";
cin>>regno;
cout<<"enter password";
cin>>pass;
switch(regno)
{
case 11002356:
if(pass==3346)
{
phy=85,cmp=90,math=95;
cout<<"name:Amit\n";
cout<<"total attendence:"<<(phy+cmp+math)/3<<"%\n";
cout<<"maths:"<<math<<"%\n";
cout<<"computer:"<<cmp<<"%\n";
cout<<"physics:"<<phy<<"%\n";
}
else
cout<<"incorrect password\n";
break;
case 11004567:
if(pass==1234)
{
phy=95,cmp=90,math=87;
cout<<"name:Neeraj\n";
cout<<"total attendence:"<<(phy+cmp+math)/3<<"%\n";
cout<<"maths:"<<math<<"%\n";
cout<<"computer:"<<cmp<<"%\n";
cout<<"physics:"<<phy<<"%\n";
}
else
cout<<"incorrect password\n";
break;
case 11009096:
if(pass==1234)
{
phy=87,cmp=90,math=56;
cout<<"name:Saurabh\n";
cout<<"total attendence:"<<(phy+cmp+math)/3<<"%\n";
cout<<"maths:"<<math<<"%\n";
cout<<"computer:"<<cmp<<"%\n";
cout<<"physics:"<<phy<<"%\n";
}
else
cout<<"incorrect password\n";
break;
default:
cout<<"regno.incorrect\n";
}
}
void ums::result()
{
int l,o;
x:
cout<<"enter registration no.";
cin>>l;
switch(l)
{
case 11002356:
cout<<"name:Amit\n";
cout<<"subjects:"<<"grades\n";
cout<<"maths   :"<<"A\n";
cout<<"physics :"<<"A+\n";
cout<<"computer:"<<"B\n";
cout<<"press [0] to go to back\n";
cout<<"press [9] to exit result\n";
cin>>o;
if(o==0)
goto x;
else
goto y;
break;
case 11004567:
cout<<"name:Neeraj\n";
cout<<"subjects:"<<"grades\n";
cout<<"maths   :"<<"B\n";
cout<<"physics :"<<"A+\n";
cout<<"computer:"<<"C\n";
cout<<"press [0] to go to back\n";
cout<<"press [9] to exit result\n";
cin>>o;
if(o==0)
goto x;
else
goto y;
break;
case 11009096:
cout<<"name:Saurabh\n";
cout<<"subjects:"<<"grades\n";
cout<<"maths   :"<<"B\n";
cout<<"physics :"<<"C\n";
cout<<"computer:"<<"A+\n";
cout<<"press [0] to go to back\n";
cout<<"press [9] to exit result\n";
cin>>o;
if(o==0)
goto x;
else
goto y;
break;
default:
cout<<"regno. incorrect\n";
cout<<"press [0] to go to back\n";
cout<<"press [9] to exit  result\n";
cin>>o;
if(o==0)
goto x;
else
goto y;
}
y:
}


void main()
{
int n,k;
class ums u;
clrscr();
x:
u.input();
u.data();
cin>>n;
switch(n)
{
case 1:
u.library();
cout<<"enter [5] to goto start\n";
cout<<"press [9] to exit program\n";
cin>>k;
if(k==5)
goto x;
else
goto y;
case 2:
u.attend();
cout<<"enter [5] to goto start\n";
cout<<"press [9] to exit program\n";
cin>>k;
if(k==5)
goto x;
else
goto y;
case 3:
u.result();
cout<<"enter [5] to goto start\n";
cout<<"press [9] to exit program\n";
cin>>k;
if(k==5)
goto x;
goto y;
}
y:
getch();
}


To Check:-
  Registration no.-11002356 Password-3346
  Registration no.- 11004567  Password-1234                                       







3 comments: