Problem 1.20 It make ideal result but presentation error.

FatimahAlkulaib Reply 9 years 5 weeks ago
#include <stdio.h> #define MAXLINE 2000 /*maximum input line size*/ int main() { int i; char c,line[MAXLINE]; for(i=0;i<MAXLINE;i++) { line[i] = NULL; } i=0; while (1) { c=getchar(); if(c=='\t') { line[i] = ' '; i++; line[i] = ' '; i++; line[i] = ' '; i++; line[i] = ' '; i++; } else { if(c==EOF) break; line[i] = c; i++; } } line[i]=NULL; printf("%s", line); return 0; } =========================== Why is it going?
pichulia Reply 9 years 5 weeks ago
see this input. https://twitter.com/pichulia/status/582542186287271936/photo/1 in this case, \t(tab) should be 3 space, instead of 4 space