this the Data File: magic spell owl destine fatal pure dragon phoenix special sc
ID: 644382 • Letter: T
Question
this the Data File:
magic
spell
owl
destine
fatal
pure
dragon
phoenix
special
school
uncle
friendship
teacher
master
question
eagle
guess
human
develope
clue
blog
difficult
simulate
tiger
ratio
performance
width
care
game
dictionary
picture
choose
look
soft
assumption
eat
apple
problem
shaby
spider
map
english
romantic
music
moon
watermelon
definition
remote
freedom
similar
writer
search
inside
poodle
constraint
state
quality
slave
action
condition
google
description
cooking
handbook
research
cousin
sister
example
block
blossom
cheer
dog
cat
friend
candy
church
perfect
genre
movie
surf
club
golf
swim
country
book
best
student
teacher
computer
calculate
algorithm
photo
facebook
foundation
money
building
stone
story
store
support
grief
captain
After your program reads in the list of words, it randomly picks one word to play the game. This word is
referred to as the
Explanation / Answer
#include
const int MAX=200;
class array
{
private:
int arr[MAX];
public:
void insert(int pos,char data);
void display();
void search(int data);
};
//insert data
void array::insert(int pos,char data)
{
for (int i=MAX-1;i>=pos;i--)
arr[i]=arr[i-1];
arr[i]=data;
}
// search for data
void array::search(int data)
{
for(int i=0;i {
if(arr[i]==data)
{
cout<<" The element "<
//display data
void array::display()
{
cout< for(int i=0;i cout<<" "< }
void main()
{
array a;
char c,ch;
int n;
clrscr()
a.insert(1,magic);
a.insert(2,spell);
a.insert(3,owl);
a.insert(4,destine);
a.insert(5,fatal);
a.insert(6,pure);
a.insert(7,dragon);
a.insert(8,phoenix);
a.insert(9,special);
a.insert(10,school);
a.insert(11,uncle);
a.insert(12,friendship);
a.insert(13,teacher);
a.insert(14,master);
a.insert(15,question);
a.insert(16,eagle);
a.insert(17,guess);
a.insert(18,human);
a.insert(19,develope);
a.insert(20,clue);
a.insert(21,blog);
a.insert(22,difficult);
a.insert(23,simulate);
a.insert(24,tiger);
a.insert(25,ratio);
a.insert(26,performance);
a.insert(27,width);
a.insert(28,care);
a.insert(29,game);
a.insert(30,dictionary);
a.insert(31,picture);
a.insert(32,choose);
a.insert(33,look);
a.insert(34,soft);
a.insert(35,assumption);
a.insert(36,eat);
a.insert(37,apple);
a.insert(38,problem);
a.insert(39,shaby);
a.insert(40,spider);
a.insert(41,map);
a.insert(42,english);
a.insert(43,romantic);
a.insert(44,music);
a.insert(45,moon);
a.insert(46,watermelon);
a.insert(47,definition);
a.insert(48,remote);
a.insert(49,freedom);
a.insert(50,similar);
a.insert(51,writer);
a.insert(52,search);
a.insert(53,inside);
a.insert(54,poodle);
a.insert(55,constraint);
a.insert(56,state);
a.insert(57,quality);
a.insert(58,slave);
a.insert(59,action);
a.insert(60,condition);
a.insert(61,google);
a.insert(62,description);
a.insert(63,cooking);
a.insert(64,handbook);
a.insert(65,research);
a.insert(66,cousin);
a.insert(67,sister);
a.insert(68,example);
a.insert(69,block);
a.insert(70,blossom);
a.insert(71,cheer);
a.insert(72,dog);
a.insert(73,cat);
a.insert(77,friend);
a.insert(78,candy);
a.insert(79,church);
a.insert(80,perfect);
a.insert(81,genre);
a.insert(82,movie);
a.insert(83,surf);
a.insert(84,club);
a.insert(85,golf);
a.insert(86,swim);
a.insert(87,country);
a.insert(88,book);
a.insert(89,best);
a.insert(90,student);
a.insert(91,teacher);
a.insert(92,computer);
a.insert(93,calculate);
a.insert(94,algorithm);
a.insert(95,photo);
a.insert(96,facebook);
a.insert(97,foundation);
a.insert(98,money);
a.insert(99,building);
a.insert(100,stone);
a.insert(101,story);
a.insert(102,store);
a.insert(103,support);
a.insert(104,grief);
a.insert(105,captain);
do{
s:
cout<<" Enter 1 to continue search.... 0 to exit:";
cin>>n;
switch(n)
{
case 1:cout<<" Enter the element to search ";
cin>>c
a.search(c);
break;
case 0: exit(0);
default: cout<<" invalid choice";
goto s;
}
cout<<"do you wish to perform another operation(y/n)?.... ";
cin>>ch;
}
while(ch=='y');
}
}
OUTPUT
_____________________________________________________
Enter 1 to continue search.... 0 to exit: 1
Enter the element to search
best
The element best is present
do you wish to perform another operation(y/n)?....y
Enter 1 to continue search.... 0 to exit: 1
Enter the element to search
my
The element my is not present
do you wish to perform another operation(y/n)?....n
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.