Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5.  
  6. int czyOk1(char haslo[])
  7. {
  8. int licznikDuzychLiter = 0;
  9. int licznikMalychLiter = 0;
  10. int licznikCyfr = 0;
  11. if(sizeof(haslo)==8)
  12. {
  13. printf("gitara");
  14. for(int i=0; i < sizeof(haslo); i++)
  15. {
  16. if(haslo[i] >= 'a' && haslo[i] <= 'z')
  17. {
  18. licznikMalychLiter++;
  19. }
  20. else if(haslo[i] >= 'A' && haslo[i] <= 'Z')
  21. {
  22. licznikDuzychLiter++;
  23. }
  24. else if(haslo[i] >= '0' && haslo[i] <= '9')
  25. {
  26. licznikCyfr++;
  27. }
  28. else
  29. {
  30.  
  31. return 0;
  32. }
  33.  
  34. }
  35.  
  36. if(licznikMalychLiter > 0 && licznikCyfr > 0 && licznikDuzychLiter > 0)
  37. {
  38. printf("\nWszystko dobrze jest w porzadku");
  39. return 1;
  40. }
  41.  
  42. }
  43.  
  44. printf("\ndupa");
  45. return 0;
  46. }
  47.  
  48. int czyOk2(char haslo[])
  49. {
  50. if(sizeof(haslo) >= 8 && sizeof(haslo) <= 10 && haslo[0] >= 'A' && haslo[0] <= 'Z')
  51. {
  52.  
  53. for(int i = 1; i < sizeof(haslo); i++)
  54. {
  55. if(haslo[i] >= '0' && haslo[i] <= '9')
  56. {
  57. if(i!=sizeof(haslo)-2)
  58. {
  59. if(haslo[i] == haslo[i-1] || haslo[i] == haslo[i+1])
  60. {
  61. printf("\ndupa1");
  62. return 0;
  63. }
  64. }
  65. }
  66. else
  67. {
  68. printf("\ndupa2");
  69. return 0;
  70. }
  71. }
  72. printf("\ngitara");
  73. return 1;
  74. }
  75. else
  76. {
  77. printf("\ndupa3");
  78. return 0;
  79. }
  80. }
  81.  
  82.  
  83. int main()
  84. {
  85. char haslo[8]={'Z','1','5','2','6','3','1','2'};
  86. printf("Danio to jest gosc\n");
  87. czyOk1(haslo);
  88. czyOk2(haslo);
  89.  
  90.  
  91. return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement