Wednesday, July 18, 2012

Checking leap year

#include<conio.h>
#include<iostream.h>
int main()
{
int year;
cout<<"Enter year :";
cin>>year;
if(year%400==0||year%100==0||year%4==0)
cout<<endl<<year<<" is Leap year .";
else
cout<<endl<<year<<" is Not Leap year .";
getch();
}

Counting vowels in String

#include<conio.h>
#include<iostream.h>
int main()
{
char mystring[]="Programming is Practise";
cout<<mystring;
int x=0,count=0;
while(mystring[x]!='\0')
{
if(mystring[x]=='a'||mystring[x]=='e'||mystring[x]=='i'||mystring[x]=='o'||mystring[x]=='u'||mystring[x]=='A'||mystring[x]=='E'||mystring[x]=='I'||mystring[x]=='O'||mystring[x]=='U')
count++;
x++;


}
cout<<endl<<"There are :"<<count<<" Vowels .";
getch();
}

Hello World

#include<conio.h>
#include<iostream.h>
int main()
{
char mystring[]="Hello World";
cout<<mystring;
getch();
}