/ Published in: C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <stdio.h>#include <string.h> /* Version mit vorgegebenen Text int main (int argc, const int *argv){ int i=0, tab=0, blank=0, nl=1; char text[160]; printf("\nBitte geben Sie einen Text ein\n"); strcpy(text,"was machen wir heute noch?\nich\tweis\tnicht."); while(text[i]){ if(text[i]=='\t') tab++; else if(text[i]==' ') blank++; else if(text[i]=='\n') nl++; i++; } printf("\n'%s'\nhat %i Leerzeichen, %i Tabulatorstellen und %i Zeilen", text, blank, tab, nl); } */ int main (int argc, constchar * argv[]){ int c, tab=0, nl=1, blank=0; if(c==' ') blank++; else if(c=='\t') tab++; else if(c=='\n') nl++; } }