Advertisement
libchm

I wanted to be cool, but instead i became retard

Oct 26th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define BUFSIZE 128
  6.  
  7. int main(int argc, const char* argv[])
  8. {
  9.     char readbuf[BUFSIZE];
  10.     int x = 0;
  11.  
  12.     printf("Please Enter some rand string of char?\n");
  13.     do {
  14.         fgets(readbuf, BUFSIZE, stdin);
  15.         if(strcmp(readbuf, "\n")){
  16.             x = 1;
  17.         } else {
  18.             printf("Please, enter a valid string.\n");
  19.         }
  20.     } while(x == 0);
  21.     printf("The lenght of your string devided by 2 is %lu,"
  22.            " and the overall lenght is %lu.\n", strlen(readbuf)/2, strlen(readbuf));
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement