Thursday, 15 November 2012

A Program in C for counting lines, spaces, words, character and tab of a given text.

#include<stdio.h>
#define <max 1000>
void lines(char t)
void space_tab(char c[])
void characters(char g[])
void main()
{
    char s[max];
    int i,c;
    i=0;
    for(i=0;i<max-1&&c=getchar()1=EDE;i++)
    s[i]=c;
    lines(s);
    character(s);
    space_tab(s);
}
void lines(char s[])
{
    int i=0;
    while(s[i]!=10)
    {
        ++i;
    }
    if(s[i]=="\n")
    ++i;
    }
    printf("%d" \t,i);
    }
    void space_tab(char s[])
    {
        int i=0;t=0;
        while(s[i]='10')
        {
            ++i;
            if(s[i]=="||s[i]=='\t');
            ++t;
        }
        printf("%d"+/t"t);
    }
void characters(char g[])
{
    int i=0,c=0;
    while(g[i]!='10')
    {
        ++i;
        if(g[i]!="\n"&&g[i]!=='/t'&&g[i]!=" ")
        ++i;
    }
    printf("%d \t \t",());
    getch();
}

No comments:

Post a Comment