void filter_by_salery(double base_salery, Employee* list[], int list_size) {
    int i;
    for (i = 0; i < list_size; ++i) {
        if (list[i]->salery >= base_salery && list[i]->state == 'M')
            print_employee(list[i]);
    }
}
Exemple #2
0
void main() {
EMPLOYEE This_Employee;
    int i;
    scanf("%d",&This_Employee.age);
    scanf("%d",&This_Employee.salary);
    scanf("%d\n",&This_Employee.department);
    parse(This_Employee.name);
    for(i=0; i<=5; i++) parse(This_Employee.address[i]);
    print_employee(This_Employee);
}
Exemple #3
0
//Part A
void readFile() {
	int count = 0;
	data employees[MAX];
	
	//Open file for reading
	if(!(fpread = fopen("payfile.txt", "r"))){
		printf("File %s could not be opened. \n", "payfile.txt");
		fprintf(fpwrite,"File %s could not be opened. \n", "payfile.txt");
		exit(1);
	}
	
	//Reads in file
	while (!feof(fpread)) {
		char buf[MAX+2];
		char agebuf[4];
		char tenurebuf[2];
		char salarybuf[7];
		fgets(buf, /*count=*/MAX, fpread);
		strsub(buf, employees[count].first, 0, 6);
		strsub(buf, employees[count].initial, 8, 8);
		strsub(buf, employees[count].last, 10, 18);
		strsub(buf, employees[count].street, 19, 34);
		strsub(buf, employees[count].city, 37, 47);
		strsub(buf, employees[count].state, 49, 50);
		strsub(buf, employees[count].zip, 52, 56);
		strsub(buf, agebuf, 58, 59);
		strsub(buf, employees[count].sex, 61, 61);
		strsub(buf, tenurebuf, 63, 63);
		strsub(buf, salarybuf, 65, 71);
		employees[count].age = atoi(agebuf);
		employees[count].tenure = atoi(tenurebuf);
		employees[count].salary = atof(salarybuf);
		++count;
	}
	
	printf("Part B:\n");
	fprintf(fpwrite, "Part B:\n");
	for (int i = 0; i < count; ++i) {
		data* employee = &employees[i];
		print_employee(employee);
	}
	
}