Question

NU library is planning to develop an automated system to calculate the fines of the late returned books. Develop a system to
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm for question 4:

step1: start

step2:declare 2D character array to store names of books

step3:read books names as input from the user/student

step4:sort the array of books names using selection sort

step5:make a nested for loop where upper loop extracts each and compares this names by rest of the names

step6:after executing both the loops.finally sorted array will be obtained.

step7:display the sorted books

step8:stop

SOURCE CODE IN C lN LANGUAGE:

  •     #include <stdio.h>
  •     #include <string.h>
  •     void main()
  •     {
  • 
     
  •         char name[10][8], tname[10][8], temp[8];
  •         int i, j, n;
  • 
     
  •         printf("Enter the value of n \n");
  •         scanf("%d", &n);
  •         printf("Enter %d names n \n", n);
  • 
     
  •         for (i = 0; i < n; i++) 
  •         {
  •             scanf("%s", name[i]);
  •             strcpy(tname[i], name[i]);
  •         }
  • 
     
  •         for (i = 0; i < n - 1 ; i++)
  •         {
  •             for (j = i + 1; j < n; j++)
  •             {
  •                 if (strcmp(name[i], name[j]) > 0) 
  •                 {
  •                     strcpy(temp, name[i]);
  •                     strcpy(name[i], name[j]);
  •                     strcpy(name[j], temp);
  •                 }
  •             }
  •         }
  • 
     
  •         printf("\n----------------------------------------\n");
  •         printf("Input NamestSorted names\n");
  •         printf("------------------------------------------\n");
  • 
     
  •         for (i = 0; i < n; i++) 
  •         {
  •             printf("%s\t\t%s\n", tname[i], name[i]);
  •         }
  • 
     
  •         printf("------------------------------------------\n");
  • 
     
  •     }

for the flow chart just click on following link(note :download image from the following link there u would found flow chart)

https://github.com/shaikshahina/demo1

Add a comment
Know the answer?
Add Answer to:
NU library is planning to develop an automated system to calculate the fines of the late returned books. Develop a system to help the university to complete the task based on the given details: N...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT