Jason Baker has worked in Human Resources for over seven years. Jason began their career in 2013 as a Manager at Oregon Health and Science University. In 2020, they joined Boost Healthcare as the Human Resources Director and subsequently became the Manager of HR People & Culture.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX_LINE_LEN 1024
static char line[MAX_LINE_LEN];
static char usage[] = "usage: ffreq (-debug) filename\n";
static char couldnt_open[] = "couldn't open %s\n";
static void GetLine(FILE *fptr,char *line,int *line_len,int maxllen);
int main(int argc,char **argv)
{
int curr_arg;
bool bDebug;
FILE *fptr;
int line_len;
int line_no;
int freq[10];
int total;
int work;
int digit;
int pct;
if ((argc < 2) || (argc > 3)) {
printf(usage);
return 1;
}
bDebug = false;
for (curr_arg = 1; curr_arg < argc; curr_arg++) {
if (!strcmp(argv[curr_arg],"-debug"))
bDebug = true;
else
break;
}
if (argc - curr_arg != 1) {
printf(usage);
return 2;
}
if ((fptr = fopen(argv[curr_arg],"r")) == NULL) {
printf(couldnt_open,argv[curr_arg]);
return 3;
}
for (digit = 0; digit < 10; digit++)
freq[digit] = 0;
line_no = 0;
total = 0;
for ( ; ; ) {
GetLine(fptr,line,&line_len,MAX_LINE_LEN);
if (feof(fptr))
break;
line_no++;
work = atoi(line);
if (work < 0)
work *= -1;
while (work) {
Sign up to view 1 direct report
Get started