Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isBigger(struct filmList* current, struct filmList* previous, int option) {
- int flag = 0, i = 0;
- switch (option) {
- case 1:
- while (current->title[i] != '\0') {
- current->title[i] = tolower(current->title[i]);
- i++;
- }
- i = 0;
- while (previous->title[i] != '\0') {
- previous->title[i] = tolower(previous->title[i]);
- i++;
- }
- if ((strcmp(current->title, previous->title)) < 0) {
- flag = 1;
- }
- break;
- case 2:
- while (current->genre[i] != '\0') {
- current->genre[i] = tolower(current->genre[i]);
- i++;
- }
- i = 0;
- while (previous->genre != '\0') {
- previous->genre[i] = tolower(previous->genre[i]);
- i++;
- }
- if ((strcmp(current->genre, previous->genre)) < 0) {
- flag = 1;
- }
- break;
- case 3:
- if(current->duration < previous->duration) flag = 1;
- break;
- case 4:
- if (current->date < previous->date) flag = 1;
- break;
- }
- if (!flag) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement