Advertisement
razvanth21

Untitled

Mar 4th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. while (gresit)
  2. {
  3.     fgets(p[i]->telefon, 11, stdin);
  4.     len = strlen(p[i]->telefon);
  5.  
  6.     p[i]->telefon[len - 1] = '\0'; // fara \n la sfarsit
  7.  
  8.     if (p[i]->telefon[0] != '0' || len != 10)
  9.     {
  10.         printf("Numarul nu incepe cu 0 sau nu are 10 cifre!");
  11.         gresit = 1;
  12.     }
  13.  
  14.     else
  15.     {
  16.         gresit = 0;
  17.        
  18.         for (j = 0; j < len; j++)
  19.         {
  20.             if (!isdigit(p[i]->telefon[j]))
  21.             {
  22.                 gresit = 1;
  23.                 break;
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement