Monday, 13 February 2017

Implement this using C language

/*********************************************************
 **               Telephone Directory Maintenance System
 **                           Specification
 **               (Programming Fundamentals Project)
 **
 **Author - Sudhir S B
 **
 **
 *
 *
 *+++++++++++++++++++++++++++
 *Question Details
 *+++++++++++++++++++++++
 *
 *Login screen
        • User Id for login should be your employee id
        • If your employee id is entered for User ID, Main Menu of Telephone Directory Maintenance System should be displayed
        • If any other employee id is entered for User Id, the system should display error message "Login Denied” and should quit the application
 *
 *Add Department
        • The department code should be 4 characters long
        • The department names should not exceed 15 characters
        • The department code should start with 1000. Every new department added should get a 1 up number for the department code
        • The department codes should be unique
        • Department names cannot be duplicated. Comparison should be case insensitive
        • The department codes should be generated by the system
        • When the user finishes adding new departments, the control should return to the Department Code Maintenance Screen 
View all Departments
        • Display all the departments along with the department codes in a tabular format  
 *
 *Add New Employee
        • All fields are mandatory.
        • The name of the Employee should not exceed 25 characters.
        • The employee id should be 4 characters long.
        • The employee id should start with 1000. Every new employee added should get a 1 up number for the employee id
        • The employee ids should be unique
        • The employee ids should be generated by the system
        • When the control comes to accepting the department code, list the existing department codes along with their names on the screen for selection of the proper department code
        • Department Code must be a valid code (should be existing in dept.txt file)
        • Department name is displayed corresponding to the code entered. User should not edit this field
        • The Location should not exceed 5 characters
        • When the user finishes adding new Employee, the control should return to the
        Employee Maintenance Screen
 *
 *View all Employees
        • Display all the employees along with their department codes, employee id and other details in a tabular format
 *
 *Add New Telephone
        • All fields are mandatory
        • The employee id entered should exist
        • If the employee id does not exist, an error message should be displayed
        • The Location and Department Code (for the employee) should be displayed (From the information entered in the Employee Master screen). User should not edit these fields
        • Allocate a seven-digit telephone number depending on the department. (4-digit Department Code + 3-digit unique number starting with 001 for a particular department). The first telephone number in a particular department should start with xxxx001
        • The telephone number should be generated by the system and should be sequential
        • When the user finishes adding new Telephone Number, the control should return to the Telephone Directory Maintenance Screen
 *
 *Enquiry on Employee Name
        • Case insensitive name search should be provided
        • If the name does not exist, an error message should be displayed
        • If the name exists, the details of all the telephone numbers whose owner names match should be displayed
        • When the user finishes inquiry by employee, the control should return to the
        Telephone Enquiry Screen
 *
 *Enquiry on Telephone Number
        • Telephone number should exist.
        • If the telephone number does not exist, an error message should be displayed
 *
 *
 ************************************************************/

Wednesday, 18 January 2017

conio.h

source - https://en.wikipedia.org/wiki/Conio.h

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.[1] It is not part of the C standard library or ISO C, nor is it defined by POSIX.
This header declares several useful library functions for performing "console input and output" from a program. Most C compilers that target DOSWindows 3.xPhar Lap, DOSX, OS/2, or Win32[2] have this header and supply the associated library functions in the default C library. Most C compilers that target UNIX and Linux do not have this header and do not supply the library functions. Some embedded systems use a conio-compatible library.[3]
The library functions declared by conio.h vary somewhat different from compiler to compiler. As originally implemented in Lattice C, the various functions mapped directly to the first few DOS INT 21H functions. The library supplied with Borland's Turbo C did not use the DOS API but instead accessed video RAM directly for output and usedBIOS interrupt calls. This library also has additional functions inspired from the successful Turbo Pascal one.
Compilers that target non-DOS operating systems, such as Linux or OS/2, provide similar solutions; the unix-related curses library is very common here. Another example isSyncTERM's ciolib. The version of conio.h done by DJ Delorie for the GO32 extender is particularly extensive.[4]
Member functions
  • kbhit - Determines if a keyboard key was pressed.
  • getch - Reads a character directly from the console without buffer, and without echo.
  • getche - Reads a character directly from the console without buffer, but with echo.
  • ungetch - Puts the character c back into the keyboard buffers.
  • cgets - Reads a string directly from the console.
  • cscanf - Reads formatted values directly from the console.
  • putch - Writes a character directly to the console.
  • cputs - Writes a string directly to the console.
  • cprintf - Formats values and writes them directly to the console.
  • clrscr - Clears the screen.