write the function. if all the character in string B appear in
string A, return true, otherwise return false.
Answer Posted / raghuram.a
#include<iostream.h>
#include<string.h>
int h(char letter)
{
return(letter-97);
}
int main()
{
char str1[100],str2[100];
int i=0,count[26];
for(i=0;i<26;i++)
count[i]=0;
clrscr();
cout<<"\n\nenter 1st string:";
cin>>str1;
cout<<"\n\nenter 2nd string:";
cin>>str2;
for(i=0;i<strlen(str1);i++)
{
count[h(str1[i])]++;
}
for(i=0;i<strlen(str2);i++)
{
count[h(str2[i])]--;
} int flag=0;
for(i=0;i<26;i++)
{if(count[i]!=0)
{cout<<"\n\nnot anagrams";
flag=1;
break;
}
}
if(flag==0)
cout<<"\n\nanagrams";
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to palindrom string in c language?
create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
Develop a routine to reflect an object about an arbitrarily selected plane
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
write a program for area of circumference of shapes
What is full form of PEPSI
Write a routine to implement the polymarker function
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.
Cluster head selection in Wireless Sensor Network using C programming language.
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql