lgbasallote
  • lgbasallote
i need help in C programming ASAP
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
lgbasallote
  • lgbasallote
what's wrong with this picture? ``` void search() { int recNum; char yn[2]; while (1) { system("cls"); printf("\n\n\n\n\t\t\t\t SEARCH DATABASE\n"); printf("\t\t\t\t ~~~~~~~~~~~~~~~\n"); recNum = find(); if(recNum == MAXNAMES) printf("\n\n ENTRY NOT FOUND!!!\n"); printf("\n\n Would you like to search for another entry (Y/N) ? "); gets(yn); if( toupper(yn[0]) != 'Y') break; } } char upstrcmp(char str1[], char str2[]) { int cntr; cntr = 0; while(1) { if( toupper(str1[cntr]) != toupper(str2[cntr]) ) return 1; if( str1[cntr] == '\0' && str2[cntr] == '\0') return 0; cntr++; } } int find() { int cntr; char lookName[200]; char yn[2]; char filter[2]; while (1) { printf("\n\n\t Search by Filter\n"); printf("\t ~~~~~~~~~~~~~~~~\n"); printf("\n\t F - First Name\n"); printf("\n\t M - Middle Name\n"); printf("\n\t L - Last Name\n"); printf("\n\t S - School\n"); printf("\n\t I - ID Number\n"); printf("\n\t C - College\n"); printf("\n\t D - Degree Program\n"); printf("\n\t A - Address\n"); printf("\n\t T - Telephone Number\n"); printf("\n\t P - Cellphone Number\n"); printf("\n\n\t Enter the letter corresponding to the\n"); printf("\n\t filter you wish to use > "); gets(filter); system("cls"); filter[0] = tolower(filter[0]); if (filter[0] == 'l') { printf("\n\n\n Enter last name: "); gets(lookName); for (cntr = 0; cntr < MAXNAMES; cntr++) { if (lookName[0] == '\0') return MAXNAMES; if( !upstrcmp(studDat[cntr].lname, lookName) ) { printf("\n\n\n Student's Name: %s, %s %s\n", studDat[cntr].lname, studDat[cntr].fname, studDat[cntr].midname); if (studDat[cntr].school[0] == '\0') printf("\n School: -----\n"); else printf("\n School: %s\n", studDat[cntr].school); if (studDat[cntr].idNum[0] == '\0') printf("\n ID Number: -----\n"); else printf("\n ID Number: %s\n", studDat[cntr].idNum); if (studDat[cntr].colg[0] == '\0') printf("\n College: -----\n"); else printf("\n College: %s\n", studDat[cntr].colg); if (studDat[cntr].degProg[0] == '\0') printf("\n Degree Program: -----\n"); else printf("\n Degree Program: %s\n", studDat[cntr].degProg); if (studDat[cntr].addr[0] == '\0') printf("\n Address: -----\n"); else printf("\n Address: %s\n", studDat[cntr].addr); if (studDat[cntr].celNum[0] == '\0' && studDat[cntr].telNum[0] == '\0') printf("\n Contact Number: -----\n"); else if (studDat[cntr].telNum[0] == '\0') printf("\n Contact Number: +63%s\n", studDat[cntr].celNum); else if (studDat[cntr].celNum[0] == '\0') printf("\n Contact Number: %s\n", studDat[cntr].telNum); else printf("\n Contact Number: %s / +63%s\n", studDat[cntr].telNum, studDat[cntr].celNum); printf("\n\n Is this the correct entry (Y/N) ? "); gets(yn); if( toupper(yn[0]) == 'Y') break; } } } else continue; } return(cntr); }
lgbasallote
  • lgbasallote
as the names suggest, its function is for searching a specific entry in a database given a filter i think my problem is in the find() function it searches right. But for some reason, the program won't return a "NOT FOUND" if the name is not in the database
lgbasallote
  • lgbasallote
the program just returns "NOT FOUND" if the user inputs nothing in the Enter last name part

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

lgbasallote
  • lgbasallote
i have confirmed the for loop is not the problem...so i suppose it would be the return
lgbasallote
  • lgbasallote
i have found the problem...it is my search by filter menu...so now the question is...how do i fix it?
lgbasallote
  • lgbasallote
i narrowed the problem...it seems it's my while (1) loop
lgbasallote
  • lgbasallote
i have found the solution

Looking for something else?

Not the answer you are looking for? Search for more explanations.