VS likes to use unicode character sets. Changing the code to the following works with codeblocks 8.02 (mingw compiler).
Code:
#include <stdio.h>
int main(int argc, char* 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);
}
Better yet, write your code like this... (style points, ya know )
Code:
#include <stdio.h>
#include <conio.h>
int main(int argc, char* argv[])
{
int c = 0;
int nl = 0;
int b = 0;
int t = 0;
do{
c = getchar();
if (c == '\n')
nl++;
if (c == ' ')
b++;
if (c == '\t')
t++;
} while(c != EOF);
printf("Newlines = %d Blanks = %d Tabs = %d", nl, b, t);
}