Advertisement
apl-mhd

stringInputManualy

Oct 20th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <QCoreApplication>
  2. #include <cstdio>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.     int i, n;
  7.  
  8.     char name[20], ch;
  9.  
  10.     for(i = 0; name[i-1] != '\n'; i++ ){
  11.  
  12.             scanf("%c", &ch);
  13.             name[i] = ch;
  14.  
  15.     }
  16.  
  17.     name[i-1] = '\0';
  18.  
  19.  
  20.     printf("%s \n", name);
  21.  
  22.  
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement