Thursday, September 8, 2011

Questions of Web Development and Web Programming General


Interview question and answers for HTML, DHTML, CSS, Scripting including Interview question and answers for Java Script, VB Script and interview question answers for IIS. In this section you can find interview questions and answers for basic of web development tools. 

Interview questions and answers for HTML, Interview question and answers for DHTML, Interview question and answer for CSS, Interview question and answer for JavaScript and Visual Basic Script.
1.
What is DHTML?

DHTML means dynamic hyper text markup language it combines of static HTML, cascading style sheets (CSS) and scripting. by using scripting with CSS we can manipulate document object model (DOM) to get dynamic effect of the page.
 
2.
What are the commonly used data types in VBScript?

All data types in VBScript are variants.
 
3.
What is a virtual root and how do you create one?

A virtual root is essentially a new web site in IIS. You’d create one in the MMC by either selecting “New Virtual Site” from the site context menu, or clicking “Create” in the Home Directory tab in the properties for any existing folder. Using the first method, you can also create a virtual root that points to a logical directory outside the current web root. The new virtual root is largely, although not completely, as configurable as a new web site.
 
4.
How would you remotely administer IIS?

Win2K and Win2K3 comes with a limited terminal services server built in for remote administration of the server. Set it up as remote client and use the TS client or Remote Desktop Connection on the client to login. From there, use MMC as if you were logged on locally.
 
5.
How would you go about securing IIS and MS-SQL Server?

1. stay up to date on patches and keep security software (AV, firewall, IDS, maybe even packet logging, etc.) running.
2. IIS authenticates against domain users (even if the domain is “Local Machine”). Make sure you have no spurious users, and secure everyone’s passwords. If possible, segregate public web machines into different ACL segments (e.g. — a different domain). 
3. Be careful with security policies. The standard server install comes with hardened LSP templates, which you should consider if you’re not experienced enough to build your own. Non-front tiers should have tight security policies barring anyone outside the adjacent tiers (and maybe a test machine or two) from access.
 
6.
How do I make a graphic a link in HTML?

by Including the “img” tag between the “a href” tag and the “a” closing tag:
 
7.
What scripts ship with IIS 6.0?

iisweb.vsb to create, delete, start, stop, and list Web sites, iisftp.vsb to create, delete, start, stop, and list FTP sites, iisdir.vsb to create, delete, start, stop, and display virtual directories, iisftpdr.vsb to create, delete, start, stop, and display virtual directories under an FTP root, iiscnfg.vbs to export and import IIS configuration to an XML file
 
8.
What’s the name of the user who connects to the Web site anonymously?

IUSR_computername
 
9.
What secure authentication and encryption mechanisms are supported by IIS 6.0?

Basic authentication, Digest authentication, Advanced digest authentication, Certificate-based Web transactions that use PKCS #7/PKCS #10, Fortezza, SSL, Server-Gated Cryptography, Transport Layer Security 
 
10.
Where’s ASP cache located on IIS 6.0?

On disk, as opposed to memory, as it used to be in IIS 5. 
 
11.
What is socket pooling?

Non-blocking socket usage, introduced in IIS 6.0. More than one application can use a given socket.
 
12.
What are JavaScript types?

Number, String, Boolean, Function, Object, Null, Undefined
 
13.
How do you convert numbers between different bases in JavaScript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16); 
 
14.
What boolean operators does JavaScript support?

&&, || and ! 
 
15.
What looping structures are there in JavaScript?

for, while, do-while loops, but no foreach.
 
16.
How do you assign object properties?

obj["age"] = 17 or obj.age = 17. 
 
17.
What’s a way to append a value to an array?

arr[arr.length] = value;
 
18.
What is THIS keyword?

It refers to the current object
 
19.
What does isNaN function do?

Return true if the argument is not a number. 
 
20.
What is negative infinity?

It’s a number in JavaScript, derived by dividing negative number by zero.
 
21.
How to detect the operating system on the client machine?

In order to detect the operating system on the client machine, the navigator.appVersion
 
22.
Where are cookies actually stored on the hard disk?

This depends on the user's browser and OS.
In the case of Netscape with Windows OS,all the cookies are stored in a single file called cookies.txt

c:\Program Files\Netscape\Users\username\cookies.txt
 
23.
What can javascript programs do?

Generation of HTML pages on-the-fly without accessing the Web server. 
The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc. can be detected 
Date and Time Handling
 
24.
How to set a HTML document's background color?

document.bgcolor property can be set to any appropriate color.
 
25.
What does the "Access is Denied" IE error mean?

The "Access Denied" error in any browser is due to the following reason.A javascript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.
 
26.
Is a javascript script faster than an ASP script?

Yes.Since javascript is a client-side script it does require the web server's help for its computation,so it is always faster than any server-side script like ASP,PHP,etc..
 
27.
Are Java and JavaScript the Same?

No.java and javascript are two different languages.
Java is a powerful object - oriented programming language like C++,C whereas Javascript is a client-side scripting language with some limitations.
 
28.
How to embed javascript in a web page?

javascript code can be embedded in a web page between  
langugage="javascript"> tags
29.
How to access an external javascript file that is stored externally and not embedded?

This can be achieved by using the following tag between head tags or between body tags.

where abc.js is the external javscript file to be accessed.
 
30.
.What is the difference between an alert box and a confirmation box?

An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
 
31.
What is a prompt box?

A prompt box allows the user to enter input by providing a text box.
 
32.
Can javascript code be broken in different lines?

Breaking is possible within a string statement by using a backslash \ at the end but not within any other javascript statement.
that is ,
document.write("Hello \
world");
is possible but not 
document.write \
("hello world");
 
33.
How to hide javascript code from old browsers that dont run it?

Use the below specified style of comments 

Interview Questions for Programming General


1.
What is VSS (Visual Source Safe) ?

You can use VSS to secure code access among the developer and make control over the access right, also can check for multiple version of code.
 
2.
Assume you have an array that contains a number of strings (perhaps char * a[100]). Each string is a word from the dictionary. Your task, described in high-level terms, is to devise a way to determine and display all of the anagrams within the array (two words are anagrams if they contain the same characters; for example, tales and slate are anagrams.)

Begin by sorting each element in the array in alphabetical order. So, if one element of your array was slate, it would be rearranged to form aelst (use some mechanism to know that the particular instance of aelst maps to slate). At this point, you slate and tales would be identical: aelst. 
Next, sort the entire array of these modified dictionary words. Now, all of the anagrams are grouped together. Finally, step through the array and display duplicate terms, mapping the sorted letters (aelst) back to the word (slate or tales).
 
3.
What is the difference between a NULL pointer and a void pointer?

A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any object. A void pointer is not guaranteed to have enough bits to point to a function (though in general practice it does)
 
4.
What is encapsulation technique?

Hiding data within the class and making it available only through the methods. This technique is used to protect your class against accidental changes to fields, which might leave the class in an inconsistent state.
 
5.
Definition of Object Oriented Programming in single line?

Object oriented programming is a programming paradigm which  uses objects and its interactions to design applications  and computer programs.
 
6.
What is virtual function?

The virtual keyword means that method, property or function can be overridden
 
7.
What’s a Windows process?

It’s an application that’s running and had been allocated memory.
 
8.
What is programming?

Computer programming is writing or editing a computer program. A computer program is a set of instructions which determine how the computer will react to input when that program is running.
 
9.
What is a debugger?

debugger is a program in which you run another program that you are trying to debug. Inside a debugger, you can step through your program one line or instruction at a time, set break points and have your program run until it hits one, examine the contents of variables and memory, and such other useful things as that.
 
10.
what is a Programming language?

A programming language is a stylized communication technique intended to be used for controlling the behavior of a machine (often a computer). Like human languages programming languages have syntactic and semantic rules used to define meaning.
 
11.
What's the difference between a programming language, a scripting language?

The main difference between a "programming language" (C, C++ etc.) and a "scripting language" (ASP, JSP, JavaScript, VBScript) is that code written in a programming language needs to be compiled before it is run. Once it is compiled, it can be run any number of times.

Scripting languages, on the other hand, are interpreted at run-time. This means that every time you want to run the program, a separate program needs to read the code, interpret it, and then follow the instructions in the code. Compiled code has already been interpreted into machine language, so it is will typically execute faster because the conversion into machine language has already been done.

Tips for success in technical interview


·         Get enough information about the organization and product.
·         Practicing for technical question answer
·         Practicing for personal, general topics, other than technical question
·         Review the job description and profile.
·         Be on time
·         Follow Up, don't let them forget about you
·         Be ready for technical test and hands on exercise
·         Avoid arrogance
·         Dress and personality
·         Ask question, show interest for the post.
·         Try to control the flow of interview, remain composed.
·         Show confident, don't be confused
·         Don't use jargon and tech term if you don't know the things in details.
·         Don't try to misguide the interviewee as they are very experienced.

Thursday, July 21, 2011

Sample project in C++

#include<iostream.h>
#include<process.h>
 #include<stdio.h>
 #include<conio.h>
 #include<fstream.h>
 class student
 {
 // int rlno;
 char na[30];
 public:
 int rlno;
 void getdata()
 {
 cout<<"\n Enter Name ";
 gets(na);
 cout<<"\n Enter roll number ";
 cin>>rlno;

}



void show()

{

// cout<<"\n Name is "<<na;

// cout<<"\n Roll number is "<<rlno;

cout<<endl<<rlno<<"\t\t\t\t"<<na;

}

};



void main()

{

clrscr();

fstream fp,temp;//objects to control files.

student stu;

int ch=0;

while(ch!=5)

{

clrscr();

cout<<"\n1. Add Student";

cout<<"\n2. List all";

cout<<"\n3. Edit";

cout<<"\n4. Delete";

cout<<"\n5. Exit";

cout<<"\n Enter your choice: ";

cin>>ch;

switch(ch)

{

case 1:

fp.open("mystu.txt",ios::app);

char ch1='y';

while(ch1=='y' || ch1=='Y')

{

cout<<"\n Enter Student details";

stu.getdata();

fp.write((char*)&stu,sizeof(stu));

cout<<"\n Do you want to add more records ";

fflush(stdin);

cin>>ch1;





}

fp.close();

break;



case 2:

clrscr();

int r=1;

fp.open("mystu.txt",ios::in);

cout<<"\nRoll Number\t\t\tName";

while(fp.read((char*)&stu,sizeof(stu)))

{

if(r>10)

{

cout<<"\n Press any key to cont...";

getch();

clrscr();

cout<<"\nRoll Number\t\t\tName";

r=1;

}

else

{

stu.show();

r++;

}

}

getch();

fp.close();



break;



case 3:

fp.open("mystu.txt",ios::in);

temp.open("temp.txt",ios::out);

int rl;

int fl=0;

char cnf='y';

cout<<"\n Enter roll number you want to edit";

cin>>rl;

while(fp.read((char*)&stu,sizeof(stu)))

{

if(stu.rlno==rl)

{

stu.show();

cout<<"\n Press y to edit or any key to ignore Update record";

fflush(stdin);

cin>>cnf;



if(cnf=='y' || cnf=='Y')

{

stu.getdata();

temp.write((char*)&stu,sizeof(stu));

fl=1;

}

else

{

temp.write((char*)&stu,sizeof(stu));

}

}

else

{



temp.write((char*)&stu,sizeof(stu));

}

}

if(fl==1)

cout<<"\n Record Updated";

else

cout<<"\n No Matching record found or Update ignored by user";

getch();



fp.close();

temp.close();

remove("mystu.txt");

rename("temp.txt","mystu.txt");



break;



case 4:



fp.open("mystu.txt",ios::in);

temp.open("temp.txt",ios::out);

int rld;

int fld=0;

char cnfd='y';

cout<<"\n Enter roll number you want to edit";

cin>>rld;

while(fp.read((char*)&stu,sizeof(stu)))

{

if(stu.rlno==rld)

{

stu.show();

cout<<"\n Press y to Delete or any key to save record";

fflush(stdin);

cin>>cnfd;



if(cnfd=='y' || cnfd=='Y')

{



fld=1;

}

else

{

temp.write((char*)&stu,sizeof(stu));

}

}

else

{



temp.write((char*)&stu,sizeof(stu));

}

}

if(fld==1)

cout<<"\n Record Deleted";

else

cout<<"\n No Matching record found or Saved by User";

getch();



fp.close();

temp.close();

remove("mystu.txt");

rename("temp.txt","mystu.txt");





break;



case 5:

cout<<"\n Thanks for using our software";

getch();

exit(0);

break;



default:

cout<<"\n Invalid Option";

getch();





}//main switch



}//while loop



}//main























Library Management System (Sample)

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<fstream.h>

#include<string.h>

#include<dos.h>

void book_menu();

void member_menu();

void issue_menu();

class book

{

public:

int bkno;

char bkna[30];

char auth[30];

char edi[20];

char pags[10];

char pblis[40];

void add();

void search();

void del();

void modify();

void show();

void exit();

};

void book::add()

{

cout<<"\n Enter book no. : ";

cin>>bkno;

cout<<"\n Enter book name : ";

gets(bkna);

cout<<"\n Enter author name : ";

gets(auth);

cout<<"\n Enter book edition : ";

gets(edi);

cout<<"\n Enter pages : ";

gets(pags);

cout<<"\n Enter book Publisher : ";

gets(pblis);

}

void book::search()

{

book b;

int d;

int f=0;

ifstream ob1;

ob1.open("book.txt",ios::in);

cout<<"\n Enter book no. to search : ";

cin>>d;

ob1.read((char*)&b,sizeof(b));

while(ob1)

{

if(b.bkno==d)

{

b.show();

cout<<"\n Book found.";

f=1;

break;

}

else

{

f=0;

}

ob1.read((char*)&b,sizeof(b));

}

if(f==0)

{

cout<<"\n Book not found.";

}

ob1.close();

getch();

}

void book::del()

{

book b;

int d;

ifstream ob2;

ofstream ob3;

ob2.open("book.txt",ios::in);

ob3.open("temp.txt",ios::app);

cout<<"\n Enter book no. to delete : ";

cin>>d;

ob2.read((char*)&b,sizeof(b));

while(ob2)

{

if(b.bkno==d)

{

b.show();

cout<<"\n Record deleted.";

}

else

{

ob3.write((char*)&b,sizeof(b));

}

ob2.read((char*)&b,sizeof(b));

}

remove("book.txt");

rename("temp.txt","book.txt");

ob2.close();

ob3.close();

getch();

}

void book::modify()

{

book b;

int d;

ifstream ob4;

ofstream ob5;

ob4.open("book.txt",ios::in);

ob5.open("temp.txt",ios::app);

cout<<"\n Enter book no. to modify record : ";

cin>>d;

ob4.read((char*)&b,sizeof(b));

while(ob4)

{

if(b.bkno==d)

{

b.show();

cout<<"\n Enter new values for record";

b.add();

ob5.write((char*)&b,sizeof(b));

}

else

{

ob5.write((char*)&b,sizeof(b));

}

ob4.read((char*)&b,sizeof(b));

}

remove("book.txt");

rename("temp.txt","book.txt");

ob4.close();

ob5.close();

getch();

}

void book::show()

{

cout<<"\n Book no. : "<<bkno;

cout<<"\n Book name : "<<bkna;

cout<<"\n Author's name : "<<auth;

cout<<"\n Book Edition : "<<edi;

cout<<"\n Book Pages : "<<pags;

cout<<"\n Book publisher : "<<pblis;

}

void book::exit()

{

getch();

}

class member

{

char nm[50];

char pno[40];

char val[30];

int idno;

char ad[100];

char mems[30];

public:

void add();

void search();

void del();

void modify();

void show();

void exit();

};

void member::add()

{

cout<<"\n Enter member name : ";

gets(nm);

cout<<"\n Enter id no. : ";

cin>>idno;

cout<<"\n Enter member address : ";

gets(ad);

cout<<"\n Enter phone no. : ";

gets(pno);

cout<<"\n Membership started on : ";

gets(mems);

cout<<"\n Membership valid upto : ";

gets(val);

}

void member::search()

{

member mem;

int d;

ifstream ob6;

int f=0;

ob6.open("meb.txt",ios::in);

cout<<"\n Enter id no. to search member : ";

cin>>d;

ob6.read((char*)&mem,sizeof(mem));

while(ob6)

{

if(mem.idno==d)

{

mem.show();

cout<<"\n Record found.";

f=1;

break;

}

else

{

f=0;

}

ob6.read((char*)&mem,sizeof(mem));

}

if(f==0)

{

cout<<"\n Record not found.";

}

ob6.close();

getch();

}

void member::del()

{

member mem;

int d;

ifstream ob7;

ofstream ob8;

ob7.open("meb.txt",ios::in);

ob8.open("temp.txt",ios::app);

cout<<"\n Enter id no. to delete a member : ";

cin>>d;

ob7.read((char*)&mem,sizeof(mem));

while(ob7)

{

if(mem.idno==d)

{

mem.show();

cout<<"\n Record deleted.";

}

else

{

ob8.write((char*)&mem,sizeof(mem));

}

ob7.read((char*)&mem,sizeof(mem));

}

remove("meb.txt");

rename("temp.txt","meb.txt");

ob7.close();

ob8.close();

getch();

}

void member::modify()

{

member mem;

int d;

ifstream ob9;

ofstream ob10;

ob9.open("meb.txt",ios::in);

ob10.open("temp.txt",ios::app);

cout<<"\n Enter id no. to modify record : ";

cin>>d;

ob9.read((char*)&mem,sizeof(mem));

while(ob9)

{

if(mem.idno==d)

{

mem.show();

cout<<"\n Enter new values for record";

mem.add();

ob10.write((char*)&mem,sizeof(mem));

}

else

{

ob10.write((char*)&mem,sizeof(mem));

}

ob9.read((char*)&mem,sizeof(mem));

}

remove("meb.txt");

rename("temp.txt","meb.txt");

ob9.close();

ob10.close();

getch();

}

void member::show()

{

cout<<"\n Id no. : "<<idno;

cout<<"\n Member name : "<<nm;

cout<<"\n Address of member : "<<ad;

cout<<"\n Phone no : "<<pno;

cout<<"\n Membership started on : "<<mems;

cout<<"\n Membership valid upto : "<<val;

}

void member::exit()

{

getch();

}

class issue

{

public:

char baa[50];

char buka[50];

char editi[59];

char doi[50];

char bi[50];

char mno[50];

char tik[40];

int bn;

issue()

{

strcpy(baa,"");

bn=0;

}

void add();

void search();

void del();

void modify();

void show();

void exit();

};



void issue::add()

{

cout<<("\n Enter book name : ");

gets(baa);

cout<<("\n Enter book author : ");

gets(buka);

cout<<("\n Enter edition : ");

gets(editi);

cout<<"\n Enter date of issue(Enter date without spaces) : ";

gets(doi);

cout<<"\n Book issued to : ";

gets(bi);

cout<<"\n Member id no. : ";

gets(mno);

cout<<"\n Ticket no. : ";

gets(tik);

}



void issue::search()

{

issue iss;

int d;

ifstream ob11;

int f=0;

ob11.open("isu.txt",ios::in);

cout<<"\n Enter book no. to search : ";

cin>>d;

ob11.read((char*)&iss,sizeof(iss));

while(ob11)

{

if(iss.bn==d)

{

iss.show();

cout<<"\n Book found.";

f=1;

break;

}

else

{

f=0;

}

ob11.read((char*)&iss,sizeof(iss));

}

if(f==0)

{

cout<<"\n Book is already issued.";

}

ob11.close();

getch();

}

void issue::del()

{

issue iss;

int d;

ifstream ob12;

ofstream ob13;

ob12.open("isu.txt",ios::in);

ob13.open("temp.txt",ios::app);

cout<<"\n Enter book no. to search : ";

cin>>d;

ob12.read((char*)&iss,sizeof(iss));

while(ob12)

{

if(iss.bn==d)

{

iss.show();

cout<<"\n Record deleted.";

}

else

{

ob13.write((char*)&iss,sizeof(iss));

}

ob12.read((char*)&iss,sizeof(iss));

}

remove("isu.txt");

rename("temp.txt","isu.txt");

ob12.close();

ob13.close();

getch();

}

void issue::modify()

{

issue iss;

int d;

ifstream ob14;

ofstream ob15;

ob14.open("isu.txt",ios::in);

ob15.open("temp.txt",ios::app);

cout<<"\n Enter book no. to modify record :";

cin>>d;

ob14.read((char*)&iss,sizeof(iss));

while(ob14)

{

if(iss.bn==d)

{

iss.show();

cout<<"\n Enter new values for record";

iss.add();

ob15.write((char*)&iss,sizeof(iss));

}

else

{

ob15.write((char*)&iss,sizeof(iss));

}

ob14.read((char*)&iss,sizeof(iss));

}

remove("isu.txt");

rename("temp.txt","isu.txt");

ob14.close();

ob15.close();

getch();

}

void issue::show()

{

cout<<"\n Book no : "<<bn;

cout<<"\n Book name : "<<baa;

cout<<"\n Book author : "<<buka;

cout<<"\n Book edition : "<<editi;

cout<<"\n Date of issue : "<<doi;

cout<<"\n Book issued to : "<<mno;

cout<<"\n Member id no. : "<<bi;

cout<<"\n Ticket no. : "<<tik;

}

void issue::exit()

{

getch();

}

class retrn

{

int bnn;

char ba[30];

char dor[20];

public:

void add();

void search();

void del();

void modify();

void show();

void exit();

};

void retrn::add()

{

issue iss;

retrn ret;

char ch='y';

ifstream ob16;

int d;

while(ch=='y'||ch=='Y')

{

ob16.open("file.txt",ios::in);

cout<<"\n Enter book no.";

cin>>bnn;

ob16.read((char*)&ret,sizeof(ret));

while(ob16)

{

if(iss.bn==bnn)

{

cout<<"\n Enter the date of return(Enter date without spaces) : ";

cin>>dor;

}

else

{

exit();

}

}

cout<<"\n Enter 'y' to continue : ";

cin>>ch;

}

}

void retrn::search()

{

retrn ret;

int d;

ifstream ob17;

int f=0;

ob17.open("file.txt",ios::in);

cout<<"Enter book no. to search : ";

cin>>d;

ob17.read((char*)&ret,sizeof(ret));

while(ob17)

{

if(ret.bnn==d)

{

ret.show();

cout<<"\n Book returned.";

f=1;

break;

}

else

{

f=0;

}

}

if(f==0)

{

cout<<"\n Book not returned.";

}

ob17.close();

}

void retrn::del()

{

retrn ret;

int d;

ifstream ob18;

ofstream ob19;

ob18.open("file.txt",ios::in);

ob19.open("temp.txt",ios::app);

cout<<"\n Enter book no. to search : ";

cin>>d;

ob18.read((char*)&ret,sizeof(ret));

while(ob18)

{

if(ret.bnn==d)

{

ret.show();

cout<<"\n Record deleted.";

}

else

{

ob19.write((char*)&ret,sizeof(ret));

}

ob18.read((char*)&ret,sizeof(ret));

}

remove("file.txt");

rename("temp.txt","file.txt");

ob18.close();

ob19.close();

}

void retrn::modify()

{

retrn ret;

int d;

ifstream ob20;

ofstream ob21;

ob20.open("file.txt",ios::in);

ob21.open("temp.txt",ios::app);

cout<<"Enter book no. to modify a record.";

cin>>d;

ob20.read((char*)&ret,sizeof(ret));

while(ob20)

{

if(ret.bnn==d)

{

ret.show();

cout<<"\n Enter new values for this record.";

ret.add();

ob21.write((char*)&ret,sizeof(ret));

}

else

{

ob21.write((char*)&ret,sizeof(ret));

}

ob20.read((char*)&ret,sizeof(ret));

}

remove("file.txt");

rename("temp.txt","file.txt");

ob20.close();

ob21.close();

getch();

}

void retrn::show()

{

cout<<"\n Book no. : "<<bnn;

cout<<"\n Book name : "<<ba;

cout<<"\n Date of issue : "<<dor;

}

void retrn::exit()

{

getch();

}

void book_menu()

{

char c='y';

ifstream ob1;

ofstream ob;

book b;

int ch;

clrscr();

cout<<"\n 1. Add new record";

cout<<"\n 2. Search record";

cout<<"\n 3. Delete record";

cout<<"\n 4. Modify record";

cout<<"\n 5. Show record";

cout<<"\n 6. Back to menu";

cout<<"\n Enter your choice : ";

cin>>ch;

switch(ch)

{

case 1:

clrscr();

ob.open("book.txt",ios::app);

while(c=='y'||c=='Y')

{

b.add();

ob.write((char*)&b,sizeof(b));

cout<<"\n Press y to Continue : ";

cin>>c;

}

ob.close();

break;

case 2:

clrscr();

b.search();

break;

case 3:

clrscr();

b.del();

break;

case 4:

clrscr();

b.modify();

break;

case 5:

clrscr();

ob1.open("book.txt",ios::in);

ob1.read((char*)&b,sizeof(b));

while(ob1)

{

b.show();

ob1.read((char*)&b,sizeof(b));

}

ob1.close();

getch();

break;

case 6:

clrscr();

b.exit();

break;

}

}

void member_menu()

{

ofstream ob;

ifstream ob1;

int ch;

int days;

member mem;

char c='y';

clrscr();

cout<<"\n 1. Add new record";

cout<<"\n 2. Search record";

cout<<"\n 3. Delete record";

cout<<"\n 4. Modify record";

cout<<"\n 5. Show record";

cout<<"\n 6. Back to menu";

cout<<"\n Enter your choice : ";

cin>>ch;

switch(ch)

{

case 1:

clrscr();

ob.open("meb.txt",ios::app);

while(c=='y'||c=='Y')

{

mem.add();

ob.write((char*)&mem,sizeof(mem));

cout<<"\n Press y to continue : ";

cin>>c;

}

ob.close();

break;

case 2:

clrscr();

mem.search();

break;

case 3:

clrscr();

mem.del();

break;

case 4:

clrscr();

mem.modify();

break;

case 5:

clrscr();

ob1.open("meb.txt",ios::in);

ob1.read((char*)&mem,sizeof(mem));

while(ob1)

{

mem.show();

ob1.read((char*)&mem,sizeof(mem));

}

ob1.close();

getch();

break;

case 6:

clrscr();

mem.exit();

break;

}

}

void issue_menu()

{

ofstream ob;

ifstream ob1;

int ch;

issue iss;

textcolor(RED);

cprintf("Warning : Book must be returned within a week or there is a fine of Rs.
2 / day.");

cout<<"\n 1. Add new record";

cout<<"\n 2. Search record";

cout<<"\n 3. Delete record";

cout<<"\n 4. Modify record";

cout<<"\n 5. Show record";

cout<<"\n 6. Back to menu";

cout<<"\n Enter your choice : ";

cin>>ch;

switch(ch)

{

case 1:

clrscr();

book b;

int bn1;

int f=0;

ifstream ob11;

ofstream ob12;



ob12.open("isu.txt",ios::app);

ob11.open("book.txt",ios::in);

cout<<"\n Enter book no. you want to Issue : ";

cin>>bn1;

ob11.read((char*)&b,sizeof(b));

while(ob11)

{

if(b.bkno==bn1)

{

iss.bn=bn1;

iss.add();

f=1;

break;

}

else

{

f=0;

}

ob11.read((char*)&b,sizeof(b));

}



if(f==0)

cout<<"\n Book not available.";

else

ob12.write((char*)&iss,sizeof(iss));



ob11.close();

ob12.close();

getch();

getch();

break;

case 2:

iss.search();

break;

case 3:

iss.del();

break;

case 4:

iss.modify();

break;

case 5:

ob1.open("isu.txt",ios::in);

ob1.read((char*)&iss,sizeof(iss));

while(ob1)

{

iss.show();

ob1.read((char*)&iss,sizeof(iss));

cout<<"\n Press any key to continue.";

getch();

}

ob1.close();

getch();

break;

case 6:

iss.exit();

break;

}

}

void main()

{

int ch;

clrscr();

while(ch!=4)

{

clrscr();

textcolor(MAGENTA+BLINK);

cprintf("..........********** Welcome to 'Library Management
Project'**********..........");

textcolor(MAGENTA);

cprintf("................................................................................");

textcolor(YELLOW);

cprintf("\n\nSubmitted To : Prem Saini Sir Submitted by : Inderjeet Singh");

textcolor(YELLOW);

cprintf("\n................................................................................");

cout<<"\n 1. Book Menu";

cout<<"\n 2. Member Menu";

cout<<"\n 3. Issue Menu";

cout<<"\n 4. Exit";

cout<<"\n Enter your choice : ";

cin>>ch;

switch(ch)

{

case 1:

clrscr();

book_menu();

break;

case 2:

clrscr();

member_menu();

break;

case 3:

clrscr();

issue_menu();

break;

case 4:

textcolor(MAGENTA);

cprintf("\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n Thanks for using it!!!");

getch();

}

}

};