Professional Documents
Culture Documents
EXPERIMENT NO : 12
ROLL NO: 19L-1367
M.MOAZ AWAN
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char c[1000], letter;
cout<<"Phrase : ";
cin.getline(c,1000,'\n');
cout<<"Letter : ";
cin>>letter;
int count = 0;
Ex 2:
Write a program that will find the number of vowels in the string.
Define a function that must take the whole string from the main and
print the number of vowels appears in the string?
Code:
#include <iostream>
#include <cstring>
using namespace std;
vowel++;
}
return vowel;
int main()
{
char c[1000];
int vowel;
cout<<"Enter the phrase : ";
cin.getline(c,1000,'\n');
vowel = phrase(c);
cout<<"Vowels : "<<vowel<<endl;
return 0;
}
Output:
Code:
#include<iostream>
#include<cstring>
using namespace std;
bool IsIdenticalArrays(int a[],int b[],int s)
{
int c;
for( c=0;c<s;c++)
{
if(a[c]==b[c])
continue;
return false;
}
return true;
}
int main()
{
int Array1[6],Array2[6];
int elements=6;
cout<<"Enter Array1 : " <<endl;
cin>>Array1[i];
cin>>Array2[j];
if(IsIdenticalArrays(Array1,Array2,elements))
cout<<"Exactly Same.";
else
cout<<"Not Same.";
return 0;
}
Output:
int a[6],b[6],c[6],d;
d=6;
cout<<"Enter Array1 : ";
for(int i=0;i<6;i++)
cin>>a[i];
cout<<"Enter Array2 : ";
for(int j=0;j<6;j++)
cin>>b[j];
PickLarger(a,b,c,d);
cout<<"Output Array : ";
for(int k=0;k<6;k++)
cout<<c[k]<<" ";
cout<<endl;
return 0;
}
Output: