Name: Anonymous 2011-09-06 7:39
Hey /prague/, beginner programmer here. I decided to make a program that prints every letter in an input in a different color. However, when I run it, it is all reproduced in blue. It there anyone who can identify the problem? This would be really helpful, education-wise.
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
void tc(int k) {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), k);}
int main() {
char r[60];
char c;
int i;
int j = 0;
for (i = 0; i < 60 && (c = getchar()) != '\n'; i++)
r[i] = c;
int l = i;
i = 0;
while (i < l) {
j++;
if (j = 16)
j = 1;
tc(j);
putchar(r[i]);
i++;
}
return 0;
}