Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

lgbasallote Group Title

i need help in C programming ASAP

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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); }

    • 2 years ago
  2. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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

    • 2 years ago
  3. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    the program just returns "NOT FOUND" if the user inputs nothing in the Enter last name part

    • 2 years ago
  4. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i have confirmed the for loop is not the problem...so i suppose it would be the return

    • 2 years ago
  5. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i have found the problem...it is my search by filter menu...so now the question is...how do i fix it?

    • 2 years ago
  6. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i narrowed the problem...it seems it's my while (1) loop

    • 2 years ago
  7. lgbasallote Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i have found the solution

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.