Need help with Deleting string.
So I have to write function void Delete() which can be used to delete a string of data by inputting the Name of the employee I want to delete.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include<stdio.h>
#include<conio.h>
#include<string.h>
int i, j, n;
float EMP[50][5];
char Name[50][20], Sex[50][7];
void Input();
void Delete();
void main()
{
clrscr();
printf("Input the number of employee:"); scanf("%d", &n);
Input();
clrscr();
Delete();
getch();
}
void Input()
{
for(i=0; i<n; i++)
{
printf("Input Employee's ID:"); scanf("%f", &EMP[i][0]);
printf("Input Employee's Name:"); fflush(stdin); gets(Name[i]);
printf("Input Employee's Sex:"); fflush(stdin); gets(Sex[i]);
printf("Input the number of work hours:"); scanf("%f", &EMP[i][1]);
printf("Input the rate:"); scanf("%f", &EMP[i][2]);
EMP[i][3]=EMP[i][1]*EMP[i][2];
}
}
void Output()
{
printf("ID\tName\t\tSex\t\tHour\tRate\tSalary");
for(i=0; i<n; i++)
{
printf("\n%.0f\t", EMP[i][0]);
printf("%s\t\t", Name[i]);
printf("%s\t\t", Sex[i]);
printf("%.2f\t", EMP[i][1]);
printf("%.2f\t", EMP[i][2]);
printf("%.2f\t\n", EMP[i][3]);
}
getch();
}
void Delete()
{
...
}
|
Topic archived. No new replies allowed.