Sie sind auf Seite 1von 66

Further Programming Concept In C++(FPC)

FURTHER PROGRAMMING CONCEPT IN C++


CE00314-2
INDIVIDUAL PROJECT – 5th SEMESTER

Module : Further Programming Concept

Module Code : CE00314-2 & FPC[C++]

Student Name : Ryan Prasad

Intake : pt0881151 [Software]

Date Due In : 11/11/2010

Asia Pacific Institute Of Information Technology and Staffordshire 1


University,London
Further Programming Concept In C++(FPC)

CERTIFICATE

This is to certify that Mr. Ryan Prasad (pt0881151), have submitted the FURTHER
PROGRAMING CONCEPT Project. He has successfully completed the project in the
assigned duration, under the guidance of Ryan Prasad, Project Co-coordinator.

Asia Pacific Institute Of Information Technology and Staffordshire 2


University,London
Further Programming Concept In C++(FPC)

TABLE OF CONTENT

Acknowledgement
Introduction of Project
Design of implemented code
OOPS concept implementation
Validation codes applied into implementation code
Reference:

Asia Pacific Institute Of Information Technology and Staffordshire 3


University,London
Further Programming Concept In C++(FPC)

ACKNOWLEDGEMENT

Firstly I would like to give thanks to APIIT INDIA for giving us the opportunity to do
such a project. Then I would like to give thanks to my lecturer Aditi mittal for teaching us
FPC module. Then I would like to thank to our director sir for providing me a great
platform. Without those helps it can’t be come to completion.
We are making Software in FPC on an organization. It is a project where different
persons have different access priority like administrator can add, delete, update, and view
and search all the people’s records. Increased competition from existing and emerging
competitors this software will constantly consider better ways to meet the needs of the
organization .This is a very interactive project & user friendly project.

Asia Pacific Institute Of Information Technology and Staffordshire 4


University,London
Further Programming Concept In C++(FPC)

Introduction
The module “further programming in C++” completely allows us to deal with several
practical programming approaches of problem solving. With its object oriented handling
and structure C++ proves to be the best programming language for many applications.
The project is to development on “faculty management system” using C++ code with
object oriented concept and to introduce current technical issues in the field of object
oriented programming (OOP).
The basic objectives were:-
There are two modules –administrator and user.
The application will be used by the administrator to enter,search,edit and view
the product information.
The interface should be attractive, very user friendly.
Delete the record of faculty,calculate the salary of faculty.

The main objective that is needed to be kept in mind is that our program meets all system
requirements.

PROJECT DESCRIPTION

FUNCTIONALITY –
It is a very simple and easy to use program created as per the given conditions of
the faculty management system. This application will be used by the administrator
to enter, search, edit and view the faculty information and information can be
generated for the faculty according to annual salary.
The administrator is allowed to:
- Register faculty as users of the system
- Add, search and edit personal information of faculty
- Delete record of any faculty
Asia Pacific Institute Of Information Technology and Staffordshire 5
University,London
Further Programming Concept In C++(FPC)

- Calculate salary package


The following details of each staff are recorded:
- Identification Card (IC) Number
- Name
- Gender
- Qualification
- Designation
- Department
- Date Joined
- Nationality
- Date Of Birth
- Marital Status
NOTE: Each staff has a unique Identification Card (IC) Number and this will
be automatically generated by the system has a unique id number.
The search of any faculty in the system can be done by using the following
categories:
- Identification Card (IC) Number
- Designation
- Department
HARDWARE AND SOFTWARE SPECIFICATIONS –
For the proper running the program, the user should need the following hardware and
software requirements.

Hardware –
 LCD/CRT Monitor –
o A LCD or a CRT monitor is greatest necessary for the functioning of the
program. A screen that shall display all the information regarding the final
result is very necessary. The user will be able to use the program and the
administrator can maintain every detail only if provided with a screen, i.e.
a LCD or CRT monitor.

Asia Pacific Institute Of Information Technology and Staffordshire 6


University,London
Further Programming Concept In C++(FPC)

 Keyboard –
o For the entry of commands to book a following seat, the keyboard is
necessary. The most popular keyboard is the QWERTY keyboard.
 RAM & Hard Disk –
o A minimum of 512 MB RAM is required for the proper running of the
program without any hindrance. Also a hard disk space of minimum 50-80
GB should be available.

 Software –
 Windows 98/XP/Vista or Linux –
o An operating system that supports the Microsoft Visual C++ 6.0 for the
program to run is necessary to be installed.

 Microsoft Visual C++ 6.0


o To develop a Win32 console application for our system.

Asia Pacific Institute Of Information Technology and Staffordshire 7


University,London
Further Programming Concept In C++(FPC)

Design of the implemented code

Description: In college record maintenance system administrator has the highest


access priority means he can do all the functionality given in the system. He can open,
view, change, update and delete all the information of the person related to the school
system. Second highest priority is given to human resource person who can open, change,
update and delete all the information of only staff person he would not have any kind of
access priority to the admin record and at last lowest access priority is given to the staff
who can only view his own record and able change his password only not all the record.

Justification: As I already told about access priority of the different persons of the
organization generally admin of the any organization have more powerful persons so I
have given top position to the admin. I have given second access priority to the faculty
because it has more powerful than a staff. When we consider about staff then generally
they are third grade persons so they have lowest access priority.

Description and justification of the implementation codes in terms of object oriented


programming concepts
What is object?
Before discussing about object oriented programming it is important to know
something about objects. An object can be defined as a real world entity that can perform
a set of activities which determines its behavior. An object requests another object to

Asia Pacific Institute Of Information Technology and Staffordshire 8


University,London
Further Programming Concept In C++(FPC)

perform an action by sending a message. The object which sends the message is called as
the sender whereas the receiving object is known as the receiver.
Object Oriented Programming (OOP) is a programming paradigm that uses objects and
can be defined as the collection of cooperating objects in which each message is capable
of sending and receiving messages. OOP includes the following features:
 Class
 Object
 Inheritance
 Method
 Encapsulation
 Abstraction
 Polymorphism
Class:
A class defines the characteristics of an object i.e. what it is capable of doing, its
attributes etc. The main purpose of using classes in a program is that classes provide
modularity and structure to the program.
class admin1
{

protected:
char *admin_username;
char *admin_password;
static int authentic;

public:

void get_number(char *s,char *ad_pass)


{

Asia Pacific Institute Of Information Technology and Staffordshire 9


University,London
Further Programming Concept In C++(FPC)

int length;
length=strlen(s);
admin_username=new char[length+1];
strcpy(admin_username,s);

int length1;
length1=strlen(ad_pass);

admin_password=new char[length+1];
strcpy(admin_password,ad_pass);
Object:
Object is defined as an instance of a class which has its own state and behavior. The set
of values of the attributes of an object is called its state.

Inheritance:
Inheritance is a process in which one class inherits the property of another class. The
class which inherits the property of another class is called the derived class whereas the
class being inherited is called as the base class. The derived class has all the features of
the base class and can also add its own features. The main advantages of using
inheritance are:
 Reusability: Once a code written in base class need not to be written again and
again in the derived class.
 Saves time: By the concept of reusability, as there is no need to write the code again
and again therefore it saves time.
 Greater reliability: As inheritance increases program structure thus it results in
greater reliability.

Types of inheritance:

Asia Pacific Institute Of Information Technology and Staffordshire 10


University,London
Further Programming Concept In C++(FPC)

 Single Inheritance: Type of inheritance in which a derived class inherits from a


single base class.
 Multiple Inheritances: Type of inheritance in which a derived class inherits from
multiple base classes.
 Multilevel Inheritance: Type of inheritance in which a class inherits from a class
which itself inherits from another class thus forming a chain like structure.
class faculty1:virtual public admin1
{

protected:
char name[32];
char gender[34];
char nationality[35];
int date_of_join;
int month ;
int year;
int day;
char martial_status[21];
char password2[23];
char re_type[23];

Abstraction:
Abstraction is the property of representing the essential features and hiding the
background details. There are mainly 2 kinds of abstraction, functional abstraction and
data abstraction. The main difference between the 2 is that functional abstraction refers to
a function that can be used without taking into account how the function is implemented
whereas data abstraction refers to the data that can be used without taking into account
how the data is stored. Advantages of abstraction:
 Flexibility in approach
 Enhanced security

Asia Pacific Institute Of Information Technology and Staffordshire 11


University,London
Further Programming Concept In C++(FPC)

 Easier replacement

Polymorphism:
It is a feature of OOP which allows 2 or more methods to have the same name within a
class. Whenever that particular method is called the decision is taken by considering the
following:
 Number of parameters passed to the method.
 Type of parameters passed to the method.
 Order of parameters passed to the method.
Polymorphism is of 2 types:
 Run-time polymorphism.
 Compile-time polymorphism.
class admin2 :public faculty1,public faculty2
{
public:
void get_authentic(void);
void search_by_id(fstream &);
void search_by_desigination(fstream &);
void serach_by_department(fstream &);
void delete_by_id(fstream &);
void edit(fstream &);
void get_authentic1();

uml diagram

Class admin
1

Asia Pacific Institute Of Information Technology and Staffordshire 12


University,London
Further Programming Concept In C++(FPC)

#user name
#pass word
#name
#nationality
#gender
#

Data member

+get number;
+void help;
+qualification
+department
+double
salary
+date of birth
+date of join
+ void date
+void login
+search id
+search deap
+void put
date
+if stream
+exit

Asia Pacific Institute Of Information Technology and Staffordshire 13


University,London
Further Programming Concept In C++(FPC)

Validation is generally used while entering the data in context of this program validation
is required at many places like name of the faculty .

 Staff Number: staff number which cannot be character or specials character it


should be numeric only

 Name: Name cannot be alphanumeric or any special character also it cannot be a


number so I have given proper validation for that.

 Identification Card (IC) Number: In IC card number it will accept both numeric as
well as string value.

 Gender: As in this I have given validation, so it will accept only the specific
string value such as either M/F.

 Designation: In this it will accept only string value.

 Department: As in department also it will only accept the string value.

 Date Joined: Date of joining should always be after date of birth and it will be
numeric only .As well as date of joining always be before the system date.

 Nationality: It will accept the only string value. And it should not accept the
special character.

Asia Pacific Institute Of Information Technology and Staffordshire 14


University,London
Further Programming Concept In C++(FPC)

 Religion: It will accept only string value. And it should not accept the special
character.

 Date of Birth: Date of birth will be numeric and it will always be before the day
of joining.

 Marital Status: As in this I have given validation, so it will accept only the
specific string value such as either married or unmarried.

 Password: The length of the password should not be less than six digits.

Description and justification of the design of implementation codes.

Function:- This has been used to make the code more relevant and more fabricated and
make it more reliable.this has been used to make the code more user friendly.

Classs:- class has been ised to make the coding more real associated with the real world,
Abstration:- By useing the concept of class we can implement the concept of data
abstraction .means hiding the data from out side world.

Polymorphism:-The same value is sand to the more the one object of the class.

Inheritance:- the same property can be implemented to the child class from parent class.

Filehandaling:- the file handling has been use to save the data for the further use.

Asia Pacific Institute Of Information Technology and Staffordshire 15


University,London
Further Programming Concept In C++(FPC)

Asia Pacific Institute Of Information Technology and Staffordshire 16


University,London
Further Programming Concept In C++(FPC)

Conclusion

After this project I enabled to learn file handling techniques used in C++ (Random File
Access), various OOPS concept (Class, object, Inheritance, Polymorphism, Abstraction
etc). Since it is an individual project it gave lot of confidence to me.

Asia Pacific Institute Of Information Technology and Staffordshire 17


University,London
Further Programming Concept In C++(FPC)

Reference

E Balagurusamy, A.E. 1994, Object oriented Programming with C++ Third


Edition, McGraw-Hill, London.

H.M. Deitel , C++ How to Program, Fifth Edition, Prentice-hall of India, New
Delhi

K R Venugopal, Rajkumar, Ravishankar 2001, Mastering C++, Tata McGraw


Hill Publishing Company Limited, New Delhi.

Und. 2001, C++ Handbook, SSI Press (SSI Limited), Chennai

Asia Pacific Institute Of Information Technology and Staffordshire 18


University,London
Further Programming Concept In C++(FPC)

1.0 COURSEWORK TITLE

FACULTY MANAGMENT SYSTEM OF APIIT, INDIA

2.0 THE COURSEWORK OVERVIEW

You are required to develop a Win32 console application to enter, search,


edit and view personnel information of the faculty in APIIT INDIA based on
different access priority and calculate their salary package. This application will
be used by the faculty and the administrator of this application. The main purpose
of this application is to store and edit the complete personal record of each faculty
along with evaluation of salary (annually) in APIIT INDIA. In addition, a
supporting document is needed to reflect the design of the implementation codes
and the implementation details that utilises the object oriented programming
concepts.

3.0 OBJECTIVES OF THIS COURSEWORK

- Develop the practical ability to describe, justify and implement an object


oriented system.
- Introduce current technical issues in the field of object oriented programming
(OOP).

4.0 LEARNING OUTCOMES

At the end of this coursework, you should be able to:


- Explain object oriented programming concepts and apply them to the
modelling of real world systems.
- Explain the object oriented paradigm and utilisation of the offered facilities.
- Demonstrate the ability to develop and derive new class structures and
organise them such that they will model real world systems within computers.

5.0 TYPE
- Individual Assignment
Asia Pacific Institute Of Information Technology and Staffordshire 19
University,London
Further Programming Concept In C++(FPC)

5.1 COURSEWORK DESCRIPTION


One of the most important modules of the Faculty Management System of
APIIT INDIA is the LOGIN module. Each faculty of the system has its own user
name and password. The administrator of the application has the highest access
priority which enables him/her to perform all the functionalities that exist in the
application. In addition to that, the administrator is able to register faculties. The
faculties of the APIIT INDIA have the lowest access priority that only enables
them to view their personal information and annual salary.
The administrator is allowed to:
- Register faculty as users of the system
- Add, search and edit personal information of faculty
- Delete record of any faculty
- Calculate salary package
The following details of each staff are recorded:
- Identification Card (IC) Number
- Name
- Gender
- Qualification
- Designation
- Department
(Business/Information Networking Technology/Application
Development/Multimedia)
- Date Joined
- Nationality
- Date Of Birth
- Marital Status

Each staff has a unique Identification Card (IC) Number and this will be
automatically generated by the system.
Classification of designation for faculty is categorised as follows:

Asia Pacific Institute Of Information Technology and Staffordshire 20


University,London
Further Programming Concept In C++(FPC)

- Director
- Group Leader
- Doctorate
- Professor
- Associate Professor
- Assistant Professor
- Sr. Lecturer
- Lecturer
The category of designation and the related departments are determined by you in
the system.
Calculation of Salary will be done on the following basis:
Designation Basic Salary DA HRA
- Director Rs. 30,000 30% of BS 10% of BS
- Doctorate Rs. 28,000 27% of BS 10% of BS
- Professor Rs. 26,000 25% of BS 10% of BS
- Associate Professor Rs. 24,000 25% of BS 5% of BS
- Assistant Professor Rs. 22,000 20% of BS 5% of BS
- Sr. Lecturer Rs. 15,000 18% of BS 5% of BS
- Lecturer Rs. 10,000 12% of BS 5% of BS
A faculty can view only his/her salary package.
The searching of any record in the system must be done by using the following
categories:
- IC Number
- Designation
- Department
If a list of record is displayed after the search, the system should allow fine
searching in order to allow only one record to be displayed as the final selection.
You should design the system so that the user is able to edit the selective category
in the search record. After the edit process is done, the user is prompted for saving
purpose.

Asia Pacific Institute Of Information Technology and Staffordshire 21


University,London
Further Programming Concept In C++(FPC)

You should determine the selection in the main menu for each login user. After
each final result is displayed, the system should prompt the user whether he/she
would like to continue or not.

Asia Pacific Institute Of Information Technology and Staffordshire 22


University,London
Further Programming Concept In C++(FPC)

Coding

//using header file


#include<iostream>
#include<stdio.h>
#include<conio.h>
#include <fstream.h>
#include<iomanip.h>
#include<stdlib.h>
#include <ctype.h>
#include <string>
#include<string.h>
#include <Windows.h>
#include<process.h>

void gotoxy(int x, int y) //used for fixing the cordinates


{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE)
, coord);
}
class admin1
{

protected:
char *admin_username;
char *admin_password;
static int authentic;

public:

Asia Pacific Institute Of Information Technology and Staffordshire 23


University,London
Further Programming Concept In C++(FPC)

void get_number(char *s,char *ad_pass)


{
int length;
length=strlen(s);
admin_username=new char[length+1];
strcpy(admin_username,s);

int length1;
length1=strlen(ad_pass);

admin_password=new char[length+1];
strcpy(admin_password,ad_pass);//copying the password value

virtual void Help()//acheiving the concept of polymorphism


{

cout<<"\n\t==========================================
======================";
cout<<"\t\t------------Welcome to Help System------------
|\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO FORGET USERNAME \n\n\n";
cout<<"\t\t==>ENTER 2 TO FORGET PASSWORD
\n\n\n";
cout<<"\t\t==>ENTER 3 TO MAIN MENU \n\n\n";

};
int admin1::authentic =0;
Asia Pacific Institute Of Information Technology and Staffordshire 24
University,London
Further Programming Concept In C++(FPC)

class faculty1:virtual public admin1 //used of virtual to remove the


ambiguity in the programm
{

protected:
char name[32];
char gender[34];
char nationality[35];
int date_of_join;
int month ;
int year;
int day;
char martial_status[21];
char password2[23];
char re_type[23];
int date;
int date_of_month;
int date_of_year;
public:
int id;
char qualification[32];
char desinigation[34];
char department[32];
double salary;
int count1;
faculty1()//constructor
{
count1=0;
}
~faculty1()//destructor
{
}
void get_data(void)
{

cout<<"\n\t\t\t WELCOME TO THE REGISTER FORM OF


FACULTY\n\n\n\n\n";
SYSTEMTIME st;
GetSystemTime(&st);//used for taking the system current and time
Asia Pacific Institute Of Information Technology and Staffordshire 25
University,London
Further Programming Concept In C++(FPC)

id=st.wSecond *st.wMinute ;
cout<<" YOUR UNIQUE IDENTIFCATION NUMBER
:";
cout<<id;//generating of Uniquer ID
cout<<"\n\n\n";
cout<<" \t\t\tYOUR JOINING DATE IS :";cout<<"\n";
cout<<"Date :";setw(100);cout<<st.wDay;cout<<"\n";

cout<<"Month :";setw(100);cout<<st.wMonth;cout<<"\n";

cout<<"Year :";setw(100);cout<<st.wYear;cout<<"\n";

k:
cin.ignore(INT_MAX, '\n');
cout<<"\n\nEntre the name :";

cin.getline(name,30);

int i;
int flag=1;
for(i=0;i<strlen(name);i++)// used for validation of name
{
if((!isalpha(name[i]))&&(!isspace(name[i])))
flag=2;
}
if(flag==2)
{
printf("\nInvalid Name names accept only characters");
flag=1;
goto k;
}

cin.ignore(INT_MAX, '\n');

m:
cout<<"\n\nEntre the Gender :";
Asia Pacific Institute Of Information Technology and Staffordshire 26
University,London
Further Programming Concept In C++(FPC)

cin.getline(gender,30);
char m[]="male";
char f[]="female";
if ((strcmp(m, gender)==0) || (strcmp(f,gender)==0))//used for comparing
the gender
{

for(i=0;i<strlen(gender);i++)
{
if((!isalpha(gender[i]))&&(!isspace(gender[i])))
flag=2;
}
if(flag==2)
{
printf("\nInvalid Name names accept only characters");
flag=1;
goto m;
}
}
else
{
cout<<"Please Enter Either Male OR Female";
goto m;

}
/*
y:
char married[]="married";
char unmarried[]="unmarried";

if ((strcmp(married, martial_status)==0) ||
(strcmp(unmarried,martial_status)==0))//used for comparing the gender
{

for(i=0;i<strlen(martial_status);i++)
{

if((!isalpha(martial_status[i]))&&(!isspace(martial_status[i])))
flag=2;
Asia Pacific Institute Of Information Technology and Staffordshire 27
University,London
Further Programming Concept In C++(FPC)

}
if(flag==2)
{
printf("\nInvalid Name names accept only characters");
flag=1;
goto y;
}
}
else
{
cout<<"Please Enter Either married OR unmarried";
goto y;
}
*/
char indian[]="indian";
char forgeiner[]="forgeiner";
cout<<"Entre the Nationality "<<endl;
j:
cout<<"\t\t==>ENTER 1 TO INDIAN \n\n\n";
cout<<"\t\t==>ENTER 2 TO OTHER \n\n\n";
int cgh;
cout<<"Enter your choice";
cin>>cgh;
switch(cgh)
{
case 1:
{
strcpy(nationality,indian);
break;
}
case 2:
{

strcpy(nationality,forgeiner);
break;

}
defualt:
{
Asia Pacific Institute Of Information Technology and Staffordshire 28
University,London
Further Programming Concept In C++(FPC)

cout<<"Please Entre a Value 1 or 2 ";


goto j;
break;
}
}

char dir[]="director";
char lec[]="lecture";
char group[]="groupleader";
char doc[]="doctorate";
char pro[]="professor";
char asspro[]="assistantprofessor";
char associatepro[]="associateprofessor";
char srlecture[]="srlecturer";

l:
//used of this menu is selection of the Desigination according to
this.

cout<<"\n\t==============================================
==================";
cout<<"\t\t| SELECT YOUR QUALIFICATION HERE
|\n";

Asia Pacific Institute Of Information Technology and Staffordshire 29


University,London
Further Programming Concept In C++(FPC)

cout<<"\t===========================================
=====================\n\n\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\n\t|| Enter 1 B.TECH OR MCA OR BOTH
||\n";
cout<<"\t|| Enter 2 B.TECH OR MCA OR BOTH PLUS
EXPERINENCE(NECESSARY) ||\n";
cout<<"\t|| Enter 3 M.B.A OR MS OR MPHIL
||\n";
cout<<"\t|| Enter 4.M.B.A OR MS OR MPHIL PLUS
EXPERINECE(NECESSARY) ||\n";
cout<<"\t|| Enter 5 P.H.D ||\n";
cout<<"\t|| Enter 6 P.H.D PLUS EXPERINENCE(EXPERINCE
NECCESARY) ||\n";
cout<<"\t|| Enter 7.P.H.D PLUS MORE THEN TWO YEAR
EXPERINECE ||";
cout<<"\n\t===============ENTER YOUR CHOICE
HERE================================";
cout<<"\n\t==============your choice is=>";
int choice4;

cin>>choice4;

switch(choice4)
{
case 1:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,lec);
cout<<desinigation;

Asia Pacific Institute Of Information Technology and Staffordshire 30


University,London
Further Programming Concept In C++(FPC)

salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<salary;
break;
}
case 2:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,srlecture);
cout<<desinigation;
salary=(15000+0.08*15000+0.05*15000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<salary;
break;
}
case 3:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,asspro);
cout<<desinigation;
salary=(24000+0.25*24000+0.05*24000)*12;
cout<<" Your Anuual Package is ";
setw(50); cout<<salary;
break;
}
case 4:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,associatepro);
cout<<desinigation;
salary=(22000+20*22000+0.05*22000)*12;
cout<<" Your Anuual Package is ";
setw(50); cout<<salary;

break;
Asia Pacific Institute Of Information Technology and Staffordshire 31
University,London
Further Programming Concept In C++(FPC)

}
case 5:
{

cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,pro);
cout<<desinigation;
salary=(26000+0.25*26000+10*26000)*12;
cout<<" Your Anuual Package is ";
setw(50); cout<<salary;
break;

}
case 6:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,doc);
cout<<desinigation;
salary=(28000+0.27*28000+10*28000)*12;
cout<<" Your Anuual Package is ";
setw(50); cout<<salary;
break;

}
case 7:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(desinigation,dir);
cout<<desinigation;
salary= (30000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<salary;
break;

Asia Pacific Institute Of Information Technology and Staffordshire 32


University,London
Further Programming Concept In C++(FPC)

}
default:
{
cout<<"Please Entre the value Between 1 to 8";
goto l;
}
}

cin.ignore(INT_MAX, '\n');
char business[]="business";
char
information_Networking_technology[]="information_Networking_technolo
gy";
char application_development[]="application_development";
char multimedia[]="multimedia";

p:
cin.ignore(INT_MAX, '\n');
//used of this menu is selection of the department

cout<<"\n\t==============================================
==================";
cout<<"\t\t| SELECT YOUR DEPARTMENT HERE
|\n";

cout<<"\t===========================================
===================\n\n\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\t\t|| Enter 1 BUSINESS ||\n";
Asia Pacific Institute Of Information Technology and Staffordshire 33
University,London
Further Programming Concept In C++(FPC)

cout<<"\t|| Enter 2 INFORMATION NETWORKING


TECHNOLOGY ||\n";
cout<<"\t|| Enter 3 APPLICATION DEVELOPMENT
||\n";
cout<<"\t|| Enter 4 MULTIMEDIA ||\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\n\nEntre your Department "<<endl;
int choice7;
cin>>choice7;
switch(choice7)
{
case 1:
{
strcpy(department,business);
cout<<"It is a group leader if yes then press 1 ortherwise 2";
int count;
cin>>count;
if(count==1 && count1==0)
{
count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<salary;
break;

}
else
{
cout<<"sorry group leader is already there";
break;
}
Asia Pacific Institute Of Information Technology and Staffordshire 34
University,London
Further Programming Concept In C++(FPC)

case 2:
{
strcpy(department,information_Networking_technology);
cout<<"It is a group leader if yes then press 1 ortherwise 2";
int count;
cin>>count;
if(count==1 && count1==0)
{
count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<salary;
break;

}
else
{
cout<<"sorry group leader is already there";
break;
}

break;
}
case 3:
{
strcpy(department,application_development);
cout<<"It is a group leader if yes then press 1 ortherwise
2";
int count;
cin>>count;
if(count==1 && count1==0)
{
Asia Pacific Institute Of Information Technology and Staffordshire 35
University,London
Further Programming Concept In C++(FPC)

count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<salary;
break;

}
else
{
cout<<"sorry group leader is already there";
break;
}

break;
}
case 4:
{
strcpy(department,multimedia);
cout<<"It is a group leader if yes then press 1 ortherwise 2";
int count;
cin>>count;
if(count==1 && count1==0)
{
count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<salary;
break;

}
else
{
cout<<"sorry group leader is already there";
Asia Pacific Institute Of Information Technology and Staffordshire 36
University,London
Further Programming Concept In C++(FPC)

break;
}
break;
}
default:
{
cout<<"\t Please Entre the value 1 to 4";
goto p;
break;
}
}

/*char married[]="married";
char unmarried[]="unmarried";
cout<<"Entre the MARTIAL STATUS "<<endl;
q:
cout<<"\t\t==>ENTER 1 TO MARRIED \n\n\n";
cout<<"\t\t==>ENTER 2 TO UNMARRIED \n\n\n";
int cgh1;
switch(cgh1)
{
case 1:
{
strcpy(martial_status,married);
break;
}
case 2:
{

strcpy(martial_status,unmarried);
break;

}
default:
{
cout<<"Please Entre a Value 1 or 2 ";
goto q;
break;
Asia Pacific Institute Of Information Technology and Staffordshire 37
University,London
Further Programming Concept In C++(FPC)

}
}
*/

void put_data()//used for putting the data in console


{
void gotoxy();
SYSTEMTIME st;
GetSystemTime(&st);

cout<<"ID :";cout<<id;cout<<endl;

cout<<"DATE OF JOINING";
cout<<"DAYS ";cout<<st.wDay;cout<<endl;
cout<<"MONTHS ";cout<<st.wMonth;cout<<endl;
cout<<"YEAR ";cout<<st.wYear;cout<<endl;
cout<<"NAME :";cout<<name;cout<<endl;
cout<<"GENDER :";cout<<gender;cout<<endl;
// cout<<"QUALIFICATION :";cout<<qualification;
cout<<"DESIGINATION :";cout<<desinigation;cout<<endl;
cout<<"DEPARTMNET :";cout<<department;cout<<endl;
cout<<"NATIOALITY :";cout<<nationality;cout<<endl;
cout<<"MARTIAL STATUTS :";cout<<martial_status; cout<<endl ;
cout<<"SALARY :";cout<<salary; cout<<endl ;

};
class faculty2:public virtual admin1
{

public:
char *faulty_username;
char *faculty_password;
Asia Pacific Institute Of Information Technology and Staffordshire 38
University,London
Further Programming Concept In C++(FPC)

public:
void get_checke1(char *s1,char *ad_pass1)
{

int length;
length=strlen(s1);

faulty_username=new char[length+1];
strcpy(faulty_username,s1);
int length1;
length=strlen(ad_pass1);

faculty_password=new char[length1+1];
strcpy(faculty_password,ad_pass1);
cout<<"faulty_username";
cout<<faculty_password;

};

class admin2 :public faculty1,public faculty2


{
public:
void get_authentic(void);
void search_by_id(fstream &);
void search_by_desigination(fstream &);
void serach_by_department(fstream &);
void delete_by_id(fstream &);
void edit(fstream &);
void get_authentic1();
void Help()
{

cout<<"\n\t==========================================
======================";

Asia Pacific Institute Of Information Technology and Staffordshire 39


University,London
Further Programming Concept In C++(FPC)

cout<<"\t\t------------Welcome to FACULTY DEPARTMENT


System------------ |\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO FORGET USERNAME \n\n\n";
cout<<"\t\t==>ENTER 2 TO FORGET PASSWORD
\n\n\n";
cout<<"\t\t==>ENTER 3 TO MAIN MENU \n\n\n";

}
};
void admin2::get_authentic1()
{

void admin2::get_authentic()//mathcing the username and passowrd


{

char login_un[50], login_pw[50], username[50], password[50];

ifstream uin("user.txt");
ifstream pin("pass.txt");

int f=0;

cin.ignore(INT_MAX,'\n');
strcpy(login_un,admin_username);

while(!uin.eof ())
{
Asia Pacific Institute Of Information Technology and Staffordshire 40
University,London
Further Programming Concept In C++(FPC)

uin.getline(username, 50);
if(strcmp(login_un, username) ==0)
{
f=1;
break;
}
}
if(!f)
{
cout<<"Invalid name";
exit(1);

}
else
{
int m=0;
strcpy(login_pw,admin_password);

while(!pin.eof())
{

pin.getline(password, 50);

if (strcmp(login_pw, password) ==0)


{
m=1;
break;
}
}
if(!m)
{
cout<<"Invalid password";
exit(1);

Asia Pacific Institute Of Information Technology and Staffordshire 41


University,London
Further Programming Concept In C++(FPC)

}
void admin2::delete_by_id (fstream & ino)//used for deleting the
particular file
{
ino.clear();
ino.seekg(0);
ofstream file("temp.dat",ios::out);
int rno;
char found='f',confirm ='n';
cout<<"Entre id of the student whose record is to be deleted";
cin>>rno;
ino.read((char *) (this),sizeof(admin2));
while(!ino.eof())
{

if(id ==rno)
{
found='t';
cout<<"Are you sure wanna to delete this record(y/n)";
cin>>confirm;
if(confirm=='n')
file.write((char *)(this),sizeof(admin2));
}
else
file.write((char *)(this),sizeof(admin2));
ino.read((char *) (this),sizeof(admin2));
}
if(found=='f')
cout<<"Record not found";
ino.close();

file.close();
remove("stock.dat");
rename("temp.dat","stock.dat");
ino.open("stock.dat",ios::in);
cout<<"Now the file contain";
Asia Pacific Institute Of Information Technology and Staffordshire 42
University,London
Further Programming Concept In C++(FPC)

while(!ino.eof())
{
ino.read((char *)(this),sizeof(admin2));
put_data();
ino.read((char *)(this),sizeof(admin2));
if(ino.eof())
break;
put_data();
}
ino.clear();
// ino.close();

void admin2::search_by_id(fstream & ino)//used for searching the file


{

ino.clear();
int id_verify;
int pro=0;
cout<<"TYPE YOUR ID";
cin>>id_verify;
ino.seekg(0);
while(ino.read((char *) (this),sizeof(admin2)))
{

if(id==id_verify)
{
cout<<id;
pro=pro+1;
put_data ();
}

}
if(pro==0)
cout<<"THERE IS NO ID \n\n\n\n";
cout<<"\n\n\n\n";
//ino.close();
Asia Pacific Institute Of Information Technology and Staffordshire 43
University,London
Further Programming Concept In C++(FPC)

ino.clear();
}
void admin2::search_by_desigination (fstream & ino)//used for
searching according to desigination
{

char name1[30];
int total=0;
int cntr;
int exp=0,i=0;
cout<<"TYPE YOUR Desigination: ";
cin>>name1;
cntr=0;

ino.seekg(0);
while(ino.read((char *) (this),sizeof(admin2)))
{
int l4=strcmp(name1,desinigation );

if(l4==0)
{ exp=exp+1;
total=total+id ;
put_data ();
cntr=cntr+1;

}
}
if(exp==0)
{
cout<<"THERE IS NO ID OF THIS
NAME\n\n\n";
}
else
{
cout<<"\n";
//cout<<"YOU CAN SEE HERE ALL INFORMATION
}

Asia Pacific Institute Of Information Technology and Staffordshire 44


University,London
Further Programming Concept In C++(FPC)

cout<<"\n\n";
cout<<"\n"<<"*********************MOVE
ABOVE TO CHECK RESULTS*********************";
cout<<"\n";
cout<<"\n";
cout<<"\n";

cout<<"\n"<<"============================================
=========================";
if(cntr>1)
{
cout<<"For Fine Search "<<endl;
fstream inoutfile;
inoutfile.open ("stock.dat",ios::ate| ios::in |
ios::out|ios::binary);
search_by_id(inoutfile);
}

}
void admin2::edit (fstream & ino)//used for editing the module
{
/* ino.clear ();
ino.seekg(0);

char ck;
int nol=0,location;
int product,count=0;
char pr[10];
cout<<"ENTER YOUR ID HERE: ";
cin>>product;

ino.seekg(0);
while(ino.read((char *) (this),sizeof(admin2)))
{
nol=nol+1;

if(id==product)
{
count++;
Asia Pacific Institute Of Information Technology and Staffordshire 45
University,London
Further Programming Concept In C++(FPC)

location=(nol-1) * sizeof(admin2);
break;

}
if(ino.eof())
ino.clear();

}
if(count==0)
cout<<"Invalid ID";
else
{
ino.seekp(location);

cout<<"ENTER NEW VALUES


INFORMATION"<<"\n\n"<<"\n\n";
cout<<"\n\nEntre your Qualification";
cin.getline(qualification,100);
cin.ignore(INT_MAX,'\n');
cout<<"\n\nEntre your Desgination";
cin.ignore (INT_MAX,'\n');
cin.getline(desinigation,100);
cin.get(ck);
ino.read((char *)(this),sizeof(admin2));
}

cout<<"\n\n\n\n";
ino.clear ();
//ino.close();*/

}
void admin2::serach_by_department(fstream & ino)//search module
according to deaprtment
{

char name1[30];
int total=0;
Asia Pacific Institute Of Information Technology and Staffordshire 46
University,London
Further Programming Concept In C++(FPC)

int exp=0,i=0;
int cntr=0;
cout<<"TYPE YOUR Department: ";

cin>>name1;

ino.seekg(0);
while(ino.read((char *) (this),sizeof(admin2)))
{
int l4=strcmp(name1,department);

if(l4==0)
{ exp=exp+1;
total=total+id ;
put_data ();
cntr=cntr+1;

}
}
if(exp==0)
{
cout<<"THERE IS NO ID OF THIS
NAME\n\n\n";
}
else
{
cout<<"\n";
//cout<<"YOU CAN SEE HERE ALL INFORMATION
}

cout<<"\n\n";
cout<<"\n"<<"*********************MOVE
ABOVE TO CHECK RESULTS*********************";
cout<<"\n";
cout<<"\n";
cout<<"\n";

Asia Pacific Institute Of Information Technology and Staffordshire 47


University,London
Further Programming Concept In C++(FPC)

cout<<"\n"<<"============================================
=========================";

if(cntr>1)
{
cout<<"For Fine Search "<<endl;
fstream inoutfile;
inoutfile.open ("stock.dat",ios::ate| ios::in |
ios::out|ios::binary);
search_by_id(inoutfile);
}
}

void main()// main


{

admin2 admin2_object;//here making the object


int choice;
char user_name[23];
char user_password[23];
fstream inoutfile;
inoutfile.open ("stock.dat",ios::ate| ios::in | ios::out|ios::binary);

r:

cout<<"\n\t==========================================
======================";
cout<<"\t\t------------Welcome to Apiit Managment System----------
-- |\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO ADMIN LOGIN \n\n\n";
cout<<"\t\t==>ENTER 2 TO FACULTY LOGIN \n\n\n";
cout<<"\t\t==>ENTER 3 TO HELP \n\n\n";
cout<<"\t\t==>ENTER 4 TO MAIN \n\n\n";

Asia Pacific Institute Of Information Technology and Staffordshire 48


University,London
Further Programming Concept In C++(FPC)

cout<<"\t\t ENTER YOUR CHOICE:";


cin>> choice;

system("cls");
if(choice==1)
{
cout<<"Enter the USERNAME :";
cout<<setw(100);cin>>user_name;cout<<"\n";

printf("Enter the PASSWORD :");

int i=0;
while(i<5)
{
user_password[i]=getch();
if(user_password[i]=='\b')
{
i=i-2;
printf("\b \b");
}
else
putch('*');
i++;
}
user_password[5]='\0';
cout<<setw(100);

admin2_object.get_number(user_name,user_password);
admin2_object.get_authentic();
int cho_ice;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout<<setprecision(2);
do
{

Asia Pacific Institute Of Information Technology and Staffordshire 49


University,London
Further Programming Concept In C++(FPC)

cout<<"\n\t==========================================
======================";
cout<<"\t\t| SELECT ANY CHOICE TO PROCEED
FURTHER |\n";

cout<<"\t===========================================
=====================\n\n\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\t\t|| Enter 1 WANNA TO SEE ALL CONTENT OF
THE FILE ||\n";
cout<<"\t|| Enter 2 WANNA TO ADD THE CONTENT OF
THE FILE ||\n";
cout<<"\t|| Enter 3 WANNA TO SEARCH THE CONTENT
OF THE FILE ||\n";
cout<<"\t|| Enter 4 WANNA TO DELETE THE CONTENT OF
THE FILE ||\n";
cout<<"\t|| Enter 5 WANNA TO EDIT THE PARTICULAR
CONTENT ||\n";
cout<<"\t|| Enter 6 FOR MAIN MENU ||\n";
cout<<"\t|| ||";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";

cout<<"\n\n";
cout<<"THE VALUE YOU ENTERED FROM KEY BOARD
IS:";
cin>>cho_ice;
Asia Pacific Institute Of Information Technology and Staffordshire 50
University,London
Further Programming Concept In C++(FPC)

system("cls");
switch(cho_ice)
{

case 2:
{

admin2_object.get_data();
char ch;
cin.get(ch);
inoutfile.write((char *) & admin2_object,sizeof
admin2_object);
inoutfile.seekg(0);
cout<<"CONTENT OF APPEND FILE\n";
while(inoutfile.read((char *) & admin2_object,sizeof
admin2_object))
{
admin2_object.put_data();
}
inoutfile.clear();
break;

case 1:
{
inoutfile.seekg (0,ios::beg);

while(inoutfile.read((char *) & admin2_object,sizeof


admin2_object))
{
admin2_object.put_data ();
}
inoutfile.clear();
break;
}
case 3:
{
do
Asia Pacific Institute Of Information Technology and Staffordshire 51
University,London
Further Programming Concept In C++(FPC)

{
int ch_oice;
cout<<"\n\t==========================================
======================";
cout<<"\t\t|------------Welcome to SEARCH Department System----
-------- |\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO ID SEARCH \n";
cout<<"\t\t==>ENTER 2 TO DESINIGATION SERACH
\n\n\n";
cout<<"\t\t==>ENTER 3 TO DEPARTMENT SERACH \n\n\n";
cout<<"\t\t==>ENTER 4 TO MAIN \n\n\n";
cout<<"Enter the choice";
cin>>ch_oice;
switch(ch_oice)
{
case 1:
{
inoutfile.clear ();
admin2_object.search_by_id ( inoutfile );
break;
}
case 2:
{
inoutfile.clear();
admin2_object.search_by_desigination(inoutfile);
break;
}
case 3:
{
inoutfile.clear();
admin2_object.serach_by_department(inoutfile);
break;
}
case 4:
{
main();
Asia Pacific Institute Of Information Technology and Staffordshire 52
University,London
Further Programming Concept In C++(FPC)

break;
}

}
}
while(cho_ice!=5);

case 4:
{
inoutfile.clear();
admin2_object.delete_by_id (inoutfile);
break;
}

case 5:
{
char ck;
int nol=0,location;
int product,count=0;
char pr[10];
cout<<"ENTER YOUR PRODUCT ID HERE: ";
cin>>product;
inoutfile.seekg(0);
while(inoutfile.read((char *) & admin2_object,sizeof
admin2_object))
{
nol=nol+1;

if(admin2_object.id==product)
{
count++;

location=(nol-1) * sizeof(admin2_object);
break;
Asia Pacific Institute Of Information Technology and Staffordshire 53
University,London
Further Programming Concept In C++(FPC)

}
if(inoutfile.eof())
inoutfile.clear();
}
if(count==0)
cout<<"Invalid ID";
else
{
inoutfile.seekp(location);

cout<<"ENTER NEW VALUES


INFORMATION"<<"\n\n"<<"\n\n";

cout<<"\n\nEntre your Qualification";


char dir[]="director";
char lec[]="lecture";
char group[]="groupleader";
char doc[]="doctorate";
char pro[]="professor";
char asspro[]="assistantprofessor";
char associatepro[]="associateprofessor";
char srlecture[]="srlecturer";

l:

cout<<"\n\t==============================================
==================";
cout<<"\t\t| SELECT YOUR QUALIFICATION HERE
|\n";

cout<<"\t===========================================
=====================\n\n\n";

cout<<"\n\t==========================================
=======================";
Asia Pacific Institute Of Information Technology and Staffordshire 54
University,London
Further Programming Concept In C++(FPC)

cout<<"\n\t==========================================
=======================";
cout<<"\n\t|| Enter 1 B.TECH OR MCA OR BOTH
||\n";
cout<<"\t|| Enter 2 B.TECH OR MCA OR BOTH PLUS
EXPERINENCE(NECESSARY) ||\n";
cout<<"\t|| Enter 3 M.B.A OR MS OR MPHIL
||\n";
cout<<"\t|| Enter 4.M.B.A OR MS OR MPHIL PLUS
EXPERINECE(NECESSARY) ||\n";
cout<<"\t|| Enter 5 P.H.D ||\n";
cout<<"\t|| Enter 6 P.H.D PLUS EXPERINENCE(EXPERINCE
NECCESARY) ||\n";
cout<<"\t|| Enter 7.P.H.D PLUS MORE THEN TWO YEAR
EXPERINECE ||";
cout<<"\n\t===============ENTER YOUR CHOICE
HERE================================";
cout<<"\n\t==============your choice is=>";
int choice4;

cin>>choice4;

switch(choice4)
{
case 1:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,lec);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;
}
case 2:
{
Asia Pacific Institute Of Information Technology and Staffordshire 55
University,London
Further Programming Concept In C++(FPC)

cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,srlecture);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;

}
case 3:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,asspro);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;
}
case 4:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,associatepro);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;
}
case 5:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
Asia Pacific Institute Of Information Technology and Staffordshire 56
University,London
Further Programming Concept In C++(FPC)

strcpy(admin2_object.desinigation,pro);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;

}
case 6:
{

cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,doc);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;

}
case 7:
{
cout<<"Congratulation"<<endl;
cout<<" Your Desigination is "<<endl;
strcpy(admin2_object.desinigation,dir);
cout<<admin2_object.desinigation;
admin2_object.salary=(10000 + 0.12*1000+
0.05*10000)*12;
cout<<" Your Anuual Package is ";
setw(50);cout<<admin2_object.salary;
break;

}
default:
Asia Pacific Institute Of Information Technology and Staffordshire 57
University,London
Further Programming Concept In C++(FPC)

{
cout<<"Please Entre the value Between 1 to 8";
goto l;
}
}

cin.ignore(INT_MAX, '\n');
char business[]="business";
char
information_Networking_technology[]="information_Networking_technolo
gy";
char application_development[]="application_development";
char multimedia[]="multimedia";

p:
cin.ignore(INT_MAX, '\n');

cout<<"\n\t==============================================
==================";
cout<<"\t\t| SELECT YOUR DEPARTMENT HERE
|\n";

cout<<"\t===========================================
===================\n\n\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\t\t|| Enter 1 BUSINESS ||\n";
cout<<"\t|| Enter 2 INFORMATION NETWORKING
TECHNOLOGY ||\n";
Asia Pacific Institute Of Information Technology and Staffordshire 58
University,London
Further Programming Concept In C++(FPC)

cout<<"\t|| Enter 3 APPLICATION DEVELOPMENT


||\n";
cout<<"\t|| Enter 4 MULTIMEDIA ||\n";

cout<<"\n\t==========================================
=======================";

cout<<"\n\t==========================================
=======================";
cout<<"\n\nEntre your Department "<<endl;
int choice7;
cin>>choice7;
switch(choice7)
{
case 1:
{

strcpy(admin2_object.department,business);
cout<<"It is a group leader if yes then press 1 ortherwise 2";
int count;
cin>>count;
if(count==1 && admin2_object.count1==0)
{
admin2_object.count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
admin2_object.salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<admin2_object.salary;

}
else
{
cout<<"sorry group leader is already there";
break;
}
break;
Asia Pacific Institute Of Information Technology and Staffordshire 59
University,London
Further Programming Concept In C++(FPC)

case 2:
{

strcpy(admin2_object.department,information_Networking_technolog
y);

cout<<"It is a group leader if yes then press 1 ortherwise 2";


int count;
cin>>count;
if(count==1 && admin2_object.count1==0)
{
admin2_object. count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
admin2_object.salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<admin2_object.salary;

}
else
{
cout<<"sorry group leader is already there";
break;
}
break;

}
case 3:
{

strcpy(admin2_object.department,application_development);
cout<<"It is a group leader if yes then press 1 ortherwise 2";
Asia Pacific Institute Of Information Technology and Staffordshire 60
University,London
Further Programming Concept In C++(FPC)

int count;
cin>>count;
if(count==1 && admin2_object.count1==0)
{
admin2_object. count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
admin2_object.salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<admin2_object.salary;

}
else
{
cout<<"sorry group leader is already there";
break;
}
break;

}
case 4:
{
cout<<"It is a group leader if yes then press 1 ortherwise
2";
int count;
cin>>count;
if(count==1 && admin2_object.count1==0)
{
admin2_object. count1++;
cout<<"Congrtaulation u get the post of Group
leader";cout<<endl;
cout<<"Now your salary is ";
admin2_object.salary= (50000 + 0.30*30000+ 0.10*30000)*12 ;
cout<<" Your Anuual Package is ";
cout<<setw(50); cout<<admin2_object.salary;

}
else
Asia Pacific Institute Of Information Technology and Staffordshire 61
University,London
Further Programming Concept In C++(FPC)

{
cout<<"sorry group leader is already there";
break;
}
strcpy(admin2_object.department,multimedia);

break;
}
default:
{
cout<<"\t Please Entre the value 1 to 4";
goto p;
}
}

cin.get(ck);
inoutfile.write((char *) & admin2_object,sizeof
admin2_object)<<flush;
}

cout<<"\n\n\n\n";
break;
}

case 6:
{
main();
}

}
}

while(cho_ice!=8);

}
if(choice==2)
Asia Pacific Institute Of Information Technology and Staffordshire 62
University,London
Further Programming Concept In C++(FPC)

{
fstream inoutfile;
inoutfile.open ("stock.dat",ios::ate| ios::in |
ios::out|ios::binary);

int ch_oice;
int id_verify;

cout<<"TYPE YOUR ID";


cin>>id_verify;
inoutfile.seekg(0);
while(inoutfile.read((char *) & admin2_object,sizeof
admin2_object))
{
//int l2=strcmp(id,s.p_id);
if(admin2_object.id ==id_verify)
{
do
{

cout<<"\n\t==========================================
======================";
cout<<"\t\t| ------------Welcome to Department OF FACUTY--
---------- |\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO SALARY PACKAGE \n";
cout<<"\t\t==>ENTER 2 TO MAIN \n\n\n";

cout<<"Enter the choice";


cin>>ch_oice;
switch(ch_oice)
{
case 1:
{
inoutfile.clear();
admin2_object.search_by_id ( inoutfile);
break;
Asia Pacific Institute Of Information Technology and Staffordshire 63
University,London
Further Programming Concept In C++(FPC)

}
case 2:
{
main();
break;
}

}
}
while(ch_oice!=5);

}
else
{
cout<<"Your password is wrong";
main();
}

cout<<"\n\n\n\n";
inoutfile.close();
}

if(choice==3)
{
int choice1;

admin1 admin1_object;
admin2 admin2_object;
admin1 *address_admin1;

cout<<"\n\t==========================================
======================";
Asia Pacific Institute Of Information Technology and Staffordshire 64
University,London
Further Programming Concept In C++(FPC)

cout<<"\t\t ------------WELCOME TO HELP SYSTEM------------


|\n";

cout<<"\t===========================================
=====================\n\n\n";
cout<<"\t\t==>ENTER 1 TO FACULTY HELP \n";
cout<<"\t\t==>ENTER 2 TO ADMIN HELP \n\n\n";
cout<<"\t\t==>ENTER 3 TO MAIN \n\n\n";
cout<<"\t\t==>ENTER YOUR CHOICE \n\n\n";

cin>>choice1;
switch(choice1)
{
case 1:
{
address_admin1=&admin1_object;
address_admin1->Help();

break;
}

case 2:
{
address_admin1=&admin2_object;
address_admin1->Help();

break;

case 3:
{
main();
break;
}

}
}
Asia Pacific Institute Of Information Technology and Staffordshire 65
University,London
Further Programming Concept In C++(FPC)

if(choice==4)
{
cout<<"Thanks for your Registertaion";
}
if(choice>=5)
{
cout<<"Please Press a valid Number Between 1 To 3 ";
main();
}

Asia Pacific Institute Of Information Technology and Staffordshire 66


University,London

Das könnte Ihnen auch gefallen