dllbridge

Untitled

Apr 5th, 2026
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. #include   <stdio.h>
  6. #include  <string.h>
  7.  
  8.  
  9. /////////////////////////////////////////
  10. struct T
  11. {
  12.    
  13.     int nLen;      
  14.    
  15.     int nInt;
  16.    
  17.     T()
  18.     {
  19.        
  20.         nLen = 0;
  21.         nInt = 0;  
  22.     }
  23.    
  24.     void check_int(char *p);
  25.    
  26. };
  27.  
  28. ///////////////////////////////////////////////
  29. int main()
  30. {
  31.    
  32.     char sz[99] = "12 3";
  33.    
  34.     T t_1;
  35.    
  36.    
  37.    
  38.     t_1.check_int(sz);
  39.            
  40.     if(t_1.nInt == 1)
  41.     {              
  42.        printf("integer\n");    
  43.     }
  44.     else printf("don't know");
  45.  
  46. }
  47.  
  48.  
  49. ////////////////////////////////////////////////
  50. void T::check_int(char *p)
  51. {
  52.     nLen = strlen(p);
  53.    
  54.     int nF = 1;
  55.    
  56.     for(int i = 0; i < nLen; i++)
  57.     {
  58.        
  59.         if(p[i] < 48 || p[i] > 57) nF = 0;
  60.        
  61.     }
  62.    
  63.     if(nF == 1) nInt = 1;
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment