07 Jan

C Program to Count number of words & lines & characters without using array

C Program to count number of words & lines & characters without using array or pointers

#include <stdio.h>

#include<conio.h>

#define IN 1  //inside a word

#define OUT 0 //outside a word

main ()

{

int nl, nw, nc, state; //nl is number of line, nw for words and nc for characters

char c;

state = OUT;

nl=nw=nc=0; //initializing to 0

while ((c =getchar()) != EOF) // EOF is a character after pressing CTR+Z

{

++nc; //incrementing number of characters

if (c == ‘\n’)

++nl; //incrementing number of lines

if(c==’ ‘|| c==’\n’ ||c==’\t’)

state=IN; // changing state to inside word

if(state==IN) {

state=OUT; //changing state to outside

++nw; //incrementing number of words

}

}

printf (“%d %d %d”, nl, nw, nc);

getch();

}

10 Aug

My First Java Animation

hey there, ¬†this is my first animation made in JAVA …. I know its nothing fancy but yes its a step…

Its just a simple Ball bouncing of the boundary of the applet. I just wanted to learn some new stuffs so opened a book and started. :P

What i did was that first Defined run(), start() and stop() method overiding that of Runnable Interface. In run() method is used the sleep method to repaint my applet in extremely small intervals of time i chose 333ms.. These methods were defined in a class BOUNCE
Read More