Question
Hey Guys, I need your help here for my c programming class. I was trying to see if my program can read my resume but
Hey Guys, I need your help here for my c programming class. I was trying to see if my program can read my resume but it seem like its not working. Here the assignment:
Program Specifications:
Most larger companies have software programs that scan through submitted resumes and select the best resumes as possible interview clients.
The program will assume that there is a text file representing an applicants resume as a text file. The resume text document needs to be placed in the SRC folder of the project. You will make this document up.
You will create another separate text file which will also be placed in the SRC folder. This file will contain a bunch of keywords separated by commas. No keyword will contain a comma. You are to count the total times the keywords are found in the fake resume.
Your program will simply output to the screen the count of keywords with in the document that match the keywords.
In real life the higher the number the higher the chance that the person (the owner of the resume) will get an interview.
YOU CANNOT
-
Use global variables, in this or any program ever.
-
Use goto statement(s) , in this or any program ever.
Here my code please help:
#include
#include
#define keyword 150
#define words 50
int main() {
FILE *fp;
int r = 0, num = 0, resume = 0, compNum = 0;
char temp;
char lines[keyword][words];
char resumeTwo[keyword][words];
fp = fopen("keyword.txt", "r");
if (fp == NULL) {
//Every example says "Can't open file" But I like the java file not found exception
printf(" File Not Found ");
return 0;
}
while ((temp = fgetc(fp)) != EOF) {
if (temp != ',') {
lines[num][r] = temp;
r++;
}
else
{
lines[num][r] = '\0';
r = 0;
num++;
}
}
fclose(fp);
fp = fopen("resume.txt", "r");
r = 0;
if (fp == NULL) {
//Every example says "Can't open file" But I like the java file not found exception
printf(" File Not Found ");
return 0;
}
while ((temp = fgetc(fp)) != EOF) {
if (temp != ' ' && temp != ' ') {
resumeTwo[resume][r] = temp;
r++;
}
else
{
resumeTwo[resume][r] = '\0';
r = 0;
resume++;
}
}
for (r = 0; r < resume; r++) {
for (int j = 0; j < num; j++) {
int comp = strcmp(resumeTwo[r],lines[j]);
if (comp == 0) {
compNum++;
}
}
}
fclose(fp);
printf(" Total count of keys are %d", compNum);
printf(" Total count of keys are %d", resume);
printf(" Total count of keys are %d", num);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started