Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-------------------------------------------------------------------------
- Include files:
- --------------------------------------------------------------------------*/
- #include <stdio.h>
- #include <stdlib.h>
- /*=========================================================================
- Constants and definitions:
- ==========================================================================*/
- /* put your #defines and typedefs here*/
- /*-------------------------------------------------------------------------
- The main program. (describe what your program does here)
- -------------------------------------------------------------------------*/
- int main()
- {
- /*char movies_info[9][10] = {"Drama","Mystery","Crime","Cabbola","Noga","Flincher","Pacico","Pearcing","Pittbull"}; */
- char movies [10][100];
- int criterion[3];
- /* char * p;*/
- int c;
- int i=0,j=0;
- printf("Please enter the first criterion index \n");
- scanf("%d",&criterion[0]);
- printf("Please enter the second criterion index \n");
- scanf("%d",&criterion[1]);
- printf("Please enter the third criterion index \n");
- scanf("%d",&criterion[2]);
- getchar();
- printf("Please enter the movies list :\n");
- c = getchar();
- ungetc(c,stdin);
- for(i=0;c != EOF;i++)
- {
- c = getchar();
- ungetc(c,stdin);
- for(j=0;c != '\n' && c != EOF;j++)
- {
- c = getchar();
- if(c != '\n' && c != EOF)
- movies[i][j] = c;
- else if(c == '\n')
- {
- movies[i][j] = '\0';
- break;
- }
- else if(c == EOF)
- { movies[i][j] = '\0';
- break;
- }
- }
- }
- c = movies[0][0];
- for(i=0;(c >= 0 && c <= 127);i++)
- {
- for(j=0;c != '\0';j++)
- {
- printf("%c",movies[i][j]);
- c = movies[i][j];
- }
- c = movies[i+1][0];
- printf("\n");
- }
- return 0;
- }
- void must_see_movie(char movies [][100],char movies_info[9][10],unsigned int num [3])
- {
- int rank[10] = {0};
- int i,j,h;
- char * cretrion , * p = &movies[0][0],* check;
- for(i=0;(*p >= 0 && *p <= 127);i++)
- {
- p = &movies[i][0];
- for(h=0;h<3;h++)
- {
- cretrion = &movies_info[num[h]][0];
- check = strstr(*p,*cretrion);
- if(check != NULL)
- rank[i]++;
- }
- }
- for(j=0;j<=i;j++)
- printf("%d",rank[j]);
- }
Add Comment
Please, Sign In to add comment