Академический Документы
Профессиональный Документы
Культура Документы
Question 1: Write an interactive program in C language to manage the working of a Construction Company.
Implement and manage the records with suitable data structures using the file handling concepts that keeps track of
various projects of the company and their states (proposal, installation, maintenance, yearly contract etc.), the
business turnovers of the company, salaries of the employees, present assignments of the employees and details of
the clients. The application should be designed user-friendly.
Hint:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
main()
{
FILE *fp;
FILE *fp1;
char ans, choice, ch1;
int rec,st;
rec=sizeof(emp);
fp=fopen("d:emp.dat","a+"); //file to store tranactions
do
{
clrscr();
gotoxy(5,5);
textcolor(4);
//Menu to display options to the users
printf("\nEmployee Management System");
printf("\n\n");
printf("\n\t\t\t[A]Add record:");
printf("\n");
printf("\n\n[E]Employee Add record:");
printf("\n\n[P]Project Add record:");
printf("\n\n");
printf("\n\t\t\t[L]List Record:");
printf("\n\t\t\t[S]Search Record:");
printf("\n%d\t\t%s\t\t%2f\t\t%2f\t\t%d\t\t%2f",emp.empid,emp.ename,emp.salary,emp.ta,emp.da,emp.pid,(emp.sala
ry+emp.ta+emp.da));
}
getch();
}
else if(choice=='S'||choice=='s')
{
int no,s=0;
clrscr();
printf("\nEnter no to search:");
fflush(stdin);
scanf("%d",&no);
clrscr();
gotoxy(25,2);
textcolor(6);
printf("\nEmployee Management System");
printf("\n\n");
rewind(fp);
printf("\nEmp ID\tName\tSalary\tTA\tDA\tTotal");
printf("\n---------------------------------------\n");
while(fread(&emp,rec,1,fp)==1)
{
if(no==emp.empid)
{
printf("\n%d\t\t%s\t\t%2f\t\t%2f\t\t%2f\t\t%d\t\t%2f",emp.empid,emp.ename,emp.salary,emp.ta,emp.da,emp.pid,(e
mp.salary+emp.ta+emp.da));
s++;
break;
}
if(s==0)
printf("\nNO DATA FOUND");
getch();
}
}
gotoxy(25,40);
printf("\nDo you want to continue...(Y or N)");
scanf("%c",&ans);
}while(ans=='y'|ans=='Y');
printf("BYE..!!");
getch();
return 0;
}
MAIN SCREEN
(a) Write a program in 8086 assembly language that converts two four digit numbers
into its equivalent packed BCD. Also, it compares the numbers and displays the larger number. In case both
the numbers are same then zero can be displayed.
NUM1 DB'1234'
NUM2 DB'1235'
UNPK_NUM1 DW?
UNPK NUM2 DW?
MAX_NUM DW?
MY_DATA ENDS
MY_CODE SEGMENT
END START
(b) Write a program in 8086 assembly language that accept a string from the keyboard and then reverses a
string using stack. The string can be assumed to be available in the data segment. The results are also to be
created in the data segment.
Hint:
PTRSTR MACRO MS
MOV AH, 09H
LEA DX, MS
INT 21H
ENDM
DATA SEGMENT
STR1 DB 20
DB 20 DUP('$)
CRLF DB 0AH,0DH,$
STR2 DB 20
STACK_SEG SEGMENT
DB 25 DUP(?)
TOP_STACK LABEL BYTE
STACK_SEG ENDS
CODE SEGMENT
PTRSTR MSG1
L2: PUSH[SI]
CMP[SI], BL
JE L1
INC SI
JMP L2
L1: POP AX
MOV[DI], AX
CMP AL, BL
JE L3
JMP L2
L3: PTRSTR CRLF
PTRSTR MSG2
PTRSTR STR2+2
CODE ENDS
END START
MY_CODE SEGMENT
(d). Write a program in 8086 assembly language to evaluates 6*(x^2) + 5x + 9 if flag = = 1 or 4*(x^2) + 7 if flag = =
0. Assume x is a 16-bit unsigned integer.
Hint:
MY_DATA SEGMENT
X DW 2H
FLAG DB 0
RESULT DW?
MY_DATA ENDS
MY_CODE SEGMENT
MOV BX, AX
MOV CL, 5
END START