You are on page 1of 10

EXP13_1 INPUT #include<iostream.h> #include<conio.

h> void main() { char str[20],*p; int count=0; clrscr(); cout<<"Enter a string"; cin>>str; p=str; while(*p!='\0') { if(*p=='a'||*p=='e'||*p=='i'||*p=='o'||*p=='u'||*p=='A'||*p=='E'||*p=='I'||*p=='O'||*p=='U') { count=count+1; } p++; } cout<<"No of vowels "<<count; getch(); } OUTPUT Enter a stringsakharam No of vowels 3

EXP13_2 INPUT #include<iostream.h> #include<conio.h> void main() { clrscr(); char str[20],*p; int i=0; cout<<"Enter a string"; cin>>str; p=str; while(*p!='\0') { i=i+1; p++; } for(int j=0;j<i;j++) { cout<<*(p-1); p--; } getch(); } OUTPUT Enter a stringabcdef fedcba

EXP13_3 INPUT #include<iostream.h> #include<conio.h> void main() { clrscr(); char str[20],str1[20],*p; int j=0,i=0; cout<<"Enter a string"; cin>>str; p=str; cout<<"\nCopied string:\n"; while(*p!='\0') { j=0 ;

str1[j]=*p;

cout<<str1[j] ; j++; p++;

} getch(); } OUTPUT Enter a stringsakharam

Copied string: sakharam

EXP13_4 INPUT #include<iostream.h> #include<conio.h> void main() { char str[20],*p,s; clrscr(); cout<<"Enter a string"; cin>>str; p=str; cout<<"Enter the character to be searched"; cin>>s; while(*p!='\0') { if(*p==s) { cout<<"Character is present" ; break; } p++; } getch(); } OUTPUT Enter a stringsakharam Enter the character to be searchedk

Character is present

EXP13_5 INPUT #include<iostream.h> #include<conio.h> #include<string.h> void main() { clrscr(); char str[50],str1[20],*p; int i=0; cout<<"Enter two strings"; cin>>str>>str1; p=str1; i=strlen(str1); int k=strlen(str); for(int j=k;j<(k+i);j++) { str[j]=*p; p++; } for(j=0;j<(k+i);j++) { cout<<str[j]; } getch(); }

OUTPUT Enter two strings sakharam gawade sakharamgawade