Tuesday, June 22, 2010

Program to Print the number words in a string and Print in a Specified Format

#include"iostream.h"

void main()
{
 char a[100];
 int i=0,j=0,n[10],wn=0,count=0,n1[10] = {0,0,0,0,0,0,0,0,0,0},n2;
 clrscr();
 printf("\n PLEASE END THE STRING BY USING ( . ) SYMBOL TO GET THE CORRECT OUTPUT\n\n   ");
 gets(a);
 while(a[i] != '\0')
 {
  if(a[i] == ' ' || a[i] =='.')
  {
   n[j] = i-wn;
   wn = i+1;
   j++;
   count++;
  }
  i++;
 }

 cout <<"\n NUMBER OF WORDS : "<<"\n";

 for(i=0;i < count;i++)
 {
   n2 = n[i];
   n1[n2]++;
 }

 for(i=1;i < 10;i++)
 {
  cout << "\n NUMBER OF "<<  i <<" LETTER WORD : " <
 }
 getch();
}



INPUT
PLEASE END THE STRING BY USING ( . ) SYMBOL TO GET THE CORRECT OUTPUT
I AM HAPPY.
(END THE STRING WITH . SYMBOL)


OUTPUT WILL BE LIKE THIS
NUMBER OF 1 LETTER WORD 1
NUMBER OF 2 LETTER WORD 1
NUMBER OF 3 LETTER WORD 0
NUMBER OF 4 LETTER WORD 0
NUMBER OF 5LETTER WORD  1
NUMBER OF 6 LETTER WORD 0

Sunday, June 13, 2010

Signs Of Aged World Counting Its Days...!???

A mild earthquake (tremor) has been reported in various parts of Chennai in the early morning on Sunday, June 13, 2010. The tremor lasted for about 15-20 seconds and it was felt in areas including Chintadripet, Thiruvanmiyur, Santhome, Choolaimedu, Koyambedu, Royapettah and Aminjikarai.


After the Earthquake A few mins later all the persons sleeping in Marina Beach were cleared as there is Tsunami warning all over 7 countries in the world. Actually this ia a tremor felt in Chennai and other regions due to 7.7 Earthquake in Nicobar Islands.

Several parts of Sri Lanka experienced tremors following the earthquake, according to the head of the country's Geology and Mines Bureau, D Wijayananda.

Tuesday, June 1, 2010

PALINDROME PROGRAM IN C++ WITH EXPLANATION.. This will be correct logic which everyone expects



 What we have to do is
i)                    Find the length of the string
ii)                   Divide the length of the string by 2. Because from the first element in the array we should go until the predecessor of middle element and then from the last we go until the successor of the middle element Take this as an example
If this is the input string “LIRIL”. Here the middle element is a[3] = ‘R’, to find whether it is palindrome or not we should check as given in the diagram. Then we should compare the last element and with the first element. Like        

1.      We check the last element a[5] and the first element a[1].
2.      We check the second from the first a[2] with the second from the last a[4].
              
                  Middle element need not to be checked because it positions will not be changed if the string is reversed. This the logic behind this program.

If the length of the string is even( EG, 4 OR 8 OR 10) then there will be no middle element as given in the above example.

For eg) for the string “KAIL

                        

void main()
{
 int i,j,n=0,n1,cnt=0;
 char a[20];
 clrscr();
 printf("\n ENTER THE STRING : ");
 cin>>a;

// Here we get calculate the length of the string
 while(a[n]!='\0')
 {
 n =n+1;
 }
// Completes here

// To find the middle value. If the length is a even number it takes the value 0.
 n1 = n/2;
//completes here

/* This loop check the a[i] before n1 with a[j] until before n1. Remember a[i] starts from the first and b[j] starts from the last index */

for(i=0,j=n-1; i < n1 && j  >  n1; i++, j--)
 {
   if(a[i] == a[j])
    cnt++;
  else
  {
   printf("\n THE STRING IS NOT A PALINDROME");
   break;
  }
 }
 if(cnt == n1)
  printf("\n THE STRING IS A PALINDROME");
getch();
}

Sunday, May 30, 2010

Genius in Computer can answer for this question

In Windows Operating System

You cannot create a folder in any part of the computer with the name 'con'.
                           Create a new folder by Right Click-> New -> Folder

                           Then Right Click on it and check whether you can change it to the name 'con'.

I do not know the REASON for this. If you can,answer me.

All your suggestions are most welcome.

Thursday, May 27, 2010

A C Program to find the given sring is Palindrome or not Without using String Functions

#include"iostream.h"
#include"stdio.h"
#include"conio.h"

void main()
 {
  int i=0,j=0,n=0,cnt=0;
  char a[20],b[20];
  clrscr();

  printf(" ENTER THE STRING : ");
  cin>> a >> b;

  //TO FIND THE LENGTH WITHOUT USING STRLEN() FUNCTION
  while(a[n] != '\0')
   n = n+1;

  //TO REVERSE THE STRING WITHOUT USING STRREV() FUNCTION
  for(i=n-1;i > = 0 ; i--)
  {
   b[j] = a[i];
   j++;
  }

  //TO COMPARE THE STRINGS WITHOUT USING STRCMP() FUNCTION
  for( i = 0;i < n; i ++)
  {
   if(a[i] == b[i])
   {
    cnt++;
   }
   else
   {
    printf("GIVEN STRING IS NOT A PALINDROME");
    break;
   }
  }

   if(cnt == n)
   {
    printf("GIVEN STRING IS A PALINDROME");
   }
  getch();
}

Friday, May 14, 2010

MY SUGGESTIONS FOR BCCI AND INDIAN T20 TEAM

Strength of all other teams in world cricket is their fast bowlers
(Speed generated by them are given approximately in average)
AUSTRALIA                          - Shaun Tait - 155kmph
                                                   Mitchell Johnson - 150kmph
                                                   Dirk Nannes - 145kmph etc etc

SOUTH AFRICA                   - Daryl Steyn - 150kmph
                                                   Morne Morkel - 145kmph

NEW ZEALAND                   - Shane Bond -   150kmph

In this way every team has good fast bowlers and also other swing bowlers.

But Our team does not have any such bowlers who are really consistent. Clearly We have seen that INDIAN'S are struggling to hit face bowlers like above mentioned.(especially short pitch ball).

India is in a situation where it desperately need a couple of young guns who can bowl more than 145kmph CONSISTENTLY!.

If India get such a bowlers, indians can practise the fast bowlers short pitch tactics as well as they can make the opponent batsmans tremble as all the other teams.

So my only suggestion is India need a couple of fast bowlers. A Training program should be made and properly monitered under the supervision of legends like KAPIL DEV etc etc to make India successfull in the World's stage.

Friday, April 2, 2010

I Have submitted some Programs to understand C#

STEP 1

   // A simple program to explain the structure of a C# program
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.WriteLine(" FIRST STEP FOR A C# PROGRAM");
            Console.ReadLine();
        }
    }

* This is purely Object Oriented approach so everything must me contained in a class.
* Like the header files, here we have namespaces. Here System is a namespace and Console is a class  
   contained in that namespace. Writeline is function to display the output.
* We dont have function like getch() to make the cursor wait at the output screen. Instead of that we can  
   give the statement  Console.ReadLine();
* Again ReadLine() is a function in console class.

FRIENDSHIP


Friendship is always kind and patient.It is never jealous.
Rude at the times of bad things.
It does not have fence.
It is always a pleasure.
It is always ready to excuse whatever done, to hope till last breathe and into endeavour.

Friends are those who remebers the song in your heart and reminds you the lyrics when you forget it.

Dont ever miss such friends.

For all my dear friends