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


Please Help Members By Posting Answers For Below Questions

write a program for area of circumference of shapes

2046


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

3722


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1086


Write a program to model an exploding firecracker in the xy plane using a particle system

3705


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 ?

2273






Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

1787


why nlogn is the lower limit of any sort algorithm?

2389


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

2232


Develop a routine to reflect an object about an arbitrarily selected plane

3014


Write a routine to implement the polymarker function

4399


A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply. Sample output: Movie Seats Reservation Summary of Seats: Seat 1: Available Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 6 The Seat no. is out of range! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 The Seat no. is already reserved! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 0 GoodBye... Thank You!!!

1854


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2874


Design an implement of the inputs functions for event mode

2976


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3041


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2345