Advertisement
Rayne_47

C zajecia 11 - funkacja czy cyfra

May 13th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <ctype.h>
  4. #include <stdbool.h>
  5.  
  6.  
  7. bool CzyCyfry(const char *p) {
  8.     int i=0;
  9.     while(p[i]) {
  10.         if (!isdigit(p[i])) {
  11.             return false;
  12.         }
  13.         ++i;
  14.     }
  15. return true;
  16. }
  17.  
  18. int main() {
  19.  
  20.     char tekst[81];
  21.     while(gets(tekst)!=NULL && tekst[0]!='\n') {
  22.         if (CzyCyfry(tekst)==false) {
  23.             puts("Nie wszystkie znaki sa cyframi.");
  24.         }
  25.         else {
  26.             puts("Sa same cyfry.");
  27.         }
  28.         }
  29.        
  30.    
  31.    
  32.  
  33.  
  34.  
  35.    
  36.  
  37.  
  38.  
  39.  
  40.     getch();  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement