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

Sunday, March 21, 2010

A Program to find the grade of a student in C++


main()
{
 struct student
 {
  int reg_no,m1,m2,m3,total,avg;
  char *name;
 }stud[10];
 int i;
 clrscr();
 for(i=1;i<=1;i++)
 {
  cout<<"\nENTER THE REG_NO,NAME,M1,M2,M3 : ";
  cin>>stud[i].reg_no>>stud[i].name>>stud[i].m1>>stud[i].m2>>stud[i].m3;
 }
 for(i=1;i<=1;i++)
 {
  cout<<"\n REG_NO  : "<<<"\n NAME    : "<<<"\n M1      : "<<<"\n M2      : "<<<"\n M3      : "<
  stud[i].total = stud[i].m1+stud[i].m2+stud[i].m3;
  stud[i].avg = stud[i].total/3;
  cout<<"\n TOTAL   : "<<<"\n AVERAGE : "<
  if((stud[i].m1<50 || stud[i].m2<50 || stud[i].m3<50))
  {
   cout<<"\n RESULT  : FAIL"<
  }
  else
  {
   cout<<"\n RESULT  : PASS"<
  }
  if(stud[i].avg>90)
  {
   cout<<"\n GRADE   : OUTSTANDING";
  }
  else if(stud[i].avg>75 && stud[i].avg <90)
  {
   cout<<"\n GRADE   : FIRST CLASS";
  }
  else if(stud[i].avg>60 && stud[i].avg<75)
  {
   cout<<"\n GRADE   : SECOND CLASS";
  }
  else if(stud[i].avg>50 && stud[i].avg<60)
  {
   cout<<"\n GRADE   : THIRD CLASS";
  }
  else
  {
   cout<<"\n GRADE   : NIL";
  }
 }
 getch();
 return 0;
}

Name of this program - SACHIN. To find the batsman details such as strike rate, average etc etc

main()
{
 long runs[10],inn[10],not_out[10],tot[10],ball[10];
 long double avg[10];
 long double strk[10];
 char name[10][10];
 clrscr();
 cout<<"\n~~~~~~~~~~~~~~~ENTER THE DETAILS OF THE PLAYERS~~~~~~~~~~~~~~";
 for(int i=1;i<=1;i++)
 {
  cout<<"\n ENTER THE NAME : ";
  cin>>name[i];
  cout<<"\n NO OF MATCHES PLAYED : ";
  cin>>inn[i];
  cout<<"\n ENTER THE TOTAL RUNS SCORED : ";
  cin>>runs[i];
  cout<<"\n NUMBER OF BALLS FACED : ";
  cin>>ball[i];
  cout<<"\n NO OF TIMES NOT OUT : ";
  cin>>not_out[i];
 }
 for(i=1;i<=1;i++)
 {
  tot[i]  = inn[i]-not_out[i];
  if(inn[i]==not_out[i])
  {
   avg[i] = runs[i];
  }
  else
  {
   avg[i]  = runs[i]/tot[i];
  }
   strk[i] = (runs[i]*100)/ball[i];
  }
 for(i=1;i<=1;i++)
 {
  cout<<"\n NAMES"<<"   INNINGS"<<"       RUNS"<<"       NOT OUT"<<"      AVG"<<"      STRIKE RATE";
  cout<<"\n"<<<"\t     "<<<"\t"<<<"\t     "<<<"\t"<<<"\t   "<
 }
  getch();
  return 0;
}

A C++ PROGRAM TO FIND WHEHTHER THE GIVEN NUMBER IS PRIME OR NOT

void main()
{
 clrscr();
 int num,i,c;
 cout<<"PROGRAM TO FIND THE PRIME NUMBER";
 cout<<"\nENTER THE NUMBER : ";
 cin>>num;
 if(num==1)
 {
  cout<<"THE GIVEN NUMBER IS A PRIME NUMBER";
 }

 for(i=2;i<=num-1;i++)
 {
  if(num%i == 0)
  {
   cout<<"THE GIVEN NUMBER IS NOT A PRIME NUMBER";
   break;
  }
 }
  if(i==num)
  {
   cout<<"THE GIVEN NUMBER IS A PRIME NUMBER";
  }
 getch();
}

A PROGRAM TO FIND THE BIGGER NUMBER OF THE GIVEN SERIES

void main()
{
 int i,n,a[150],max;
 clrscr();
 cout<<"ENTER THE LIMIT : ";
 cin>>n;
 cout<<"ENTER THE ELEMENTS : ";
 for(i=1;i<=n;i++)
 {
  cin>>a[i];
 }
 max = a[1];
 for(i=1;i<=n;i++)
  {
   if(a[i]>max)
   {
    max = a[i];
   }
  }
  cout<<"\nTHE BIGGEST NUMBER IS : "<<
  getch();
}