Advertisement
belowzero

Untitled

May 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. //check what autoanaforiki means
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7.  
  8. typedef struct cList
  9. {
  10. char *concept; //concept learned
  11. char *sentence; //the sentence associated with the concept
  12. int timesUsed; //no of times the concept was used to an answer
  13. char learnedFrom[5]; //learned either from "file" or "kbrd"
  14. }conceptList;
  15.  
  16.  
  17. int main(void)
  18. {
  19. char array[10000];
  20. int sum,i,conceptstart,conceptend;
  21. conceptList c[1];
  22. scanf("%s",c[0].learnedFrom);
  23. printf ("%s \n",c[0].learnedFrom);
  24. scanf("%d",&c[0].timesUsed);
  25. printf("%d \n",c[0].timesUsed);
  26. scanf("%s",array);
  27. for (i=0;i<10000;i++)
  28. {
  29. if ((array[i])==('\n'))
  30. {
  31. sum=i;
  32. break;
  33. }
  34. printf("%d\n",i );
  35. }
  36.  
  37. for (i=0;i<sum;i++)
  38. {
  39. if ((array[i])==('>'))
  40. {
  41. conceptstart=i+2;
  42. }
  43. if ((array[i])==(':'))
  44. {
  45. conceptend=i-1;
  46. }
  47. }
  48. c[0].concept=(char*)malloc((conceptend-conceptstart)*sizeof(char));
  49. for (i=conceptstart;i<conceptend;i++)
  50. {
  51. (c[0].concept)[i]=array[i];
  52. }
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement