Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. int identyf( char *napis);
  8.  
  9. int main()
  10. {
  11. char napis[10];
  12.  
  13. if(identyf(napis)) printf("OK!");
  14. else printf(":(");
  15. return 0;
  16. }
  17.  
  18. int identyf( char *napis)
  19. {
  20. if(((napis[0]=getchar())>= 'a' && napis[0]<= 'z') || (napis[0]>='A' && napis[0]<='Z') || (napis[0] == '_'))
  21. {
  22. int i =1;
  23.  
  24. while( (napis[i])!=0)
  25. {
  26. if( !((napis[i]>='a' && napis[i] <= 'z') || (napis[i] >='A' && napis[i] <='Z') || (napis[i] >='0' && napis[i] <='9') || napis[i] == '_'))
  27. {
  28. return 0;
  29. }
  30. i=i+1;
  31. }
  32. return 1;
  33. }
  34.  
  35. else return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement