Pages

Subscribe:

Blogger templates

Monday, November 7, 2011

Vowel in String :

Programe output:
The coding starts from next line:-
---------------------------------------------------------------------------------------------------------------


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
char name[20];
int i,len=0,n;
cout<<"\nEnter a string:";
gets(name);
n=strlen(name);
for(i=0;i<=n;i++)
    {
    if(name[i]=='a'||name[i]=='e'||name[i]=='i'||name[i]=='o'||name[i]=='u')
        {
        len++;
        }
    }


cout<<"\nTotal vowels are:"<<len;
getch();
}
--------------------------------------------------------------------------------------------------------------


Monday, October 31, 2011

Display a Matrix

1. Program to print following :


-------------------------------------------------------------------------------------------------------------

//Program to Print a Matrix( 3-3)
//source ncertcpp.blogspot.com
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i,j,a[3][3];
cout<<"\nPlease enter elements of Matrix:\n";
for(i=0;i<3;i++)
 {
 for(j=0;j<3;j++)
  {
  cin>>a[i][j];
  }
 }
cout<<"\nMatrix you entered is as  follows\n";
for(i=0;i<3;i++)
 {
 for(j=0;j<3;j++)
  {
  cout<<a[i][j];
  cout<<"\t";
  }
 cout<<"\n";
 }
getch();
}
-------------------------------------------------------------------------------------------------------------




Please comment if you have any Problem.....
or if program doesnt works.....