Hey guys, I'm new to this forum and the C programming language. For some reason, I can't get this relatively simple program to print out the number of tabs, blanks and newlines I have in the input. Anybody have any ideas as to what's wrong?
Code:#include "stdafx.h" #include <stdio.h> int _tmain(int argc, _TCHAR* argv[]) { int c=0; int nl=0; int b=0; int t=0; while((c=getchar())!=EOF){ if (c== '\n') nl++; if (c==' ') b++; if (c=='\t') t++; } printf("Newlines = %d Blanks = %d Tabs = %d", nl,b,t); }



LinkBack URL
About LinkBacks




)