Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ ONLY PLEASE (using namespace std) Requested files: CrosswordGenerator.cpp, CrosswordGenerator.h, CrosswordGenerator_test.cpp A program that forms the basis of a crossword puzzle generator. In order to

C++ ONLY PLEASE (using namespace std) Requested files: CrosswordGenerator.cpp, CrosswordGenerator.h, CrosswordGenerator_test.cpp A program that forms the basis of a crossword puzzle generator. In order to create a crossword puzzle you need to identify letters that are common to one or more words. This program helps you generate crossword puzzles by identifying letters that are common to several words and string them in an intermediate data structure. Using intermediate data structures is one way to simplify your coding. You create a data structure that organizes your input so the final output is easier to create. Your CrosswordGenerator program will open a file containing a list of words. To prepare for crossword puzzle generation your code should implement the following pseudo code: Open a file named wordlist.txt Determine the number of words (N) in the file. Create an array of that size called wordArray[]; Read all the words from the file into an array called wordArray[N]. Sort the array of words by length in descending order Start at the beginning of the array (the longest word) and examine the word Find all other words in the array that can intersect the current word Two words can intersect if they share a letter. Write a function called String sharedLetters(String S1, String S2) Implement sharedLetters(S1,S2) that will return a string containing letters shared by the two parameter strings S1 and S2. If no letters are shared between S1 and S2 sharedLetters() should return the empty string "". sharedLetters(S1,S2) should ignore case; capital and lower case letters are considered equal Create a two dimensional array of Strings wordsIntersect[N][N] where each dimension N is the size of wordArray. Iterate over wordArray comparing distinct words. Do not compare a word to itself. If wordArray[i] shares any letters with wordArray[j] place the result of sharedLetters(wordArray[i],wordArray[j]) into wordsIntersect[i][j] Non-alphabetic characters should be ignored. Upper and lower case letters should be equivalent. Your program should not treat them as distinct tokens. The order of shared letters is not a consideration for this program. Write the contents of the wordsIntersect array to a Comma Separated Values (CSV) text file named wordsIntersect.csv in row-major form: row,col,value. In the example below, there is an entry in wordsIntersect[12][33] which contains the string "tci". There would also be a line in wordsIntersect.csv that contains 12,33,tci -- there are no quotes around the letters and the line ends after the letter 'i'. Given that wordsIntersect[12][78] will contains "" there would be a line in the file containing: 12,78, where there is an end of line after the last comma. Example of what sharedLetters() output. SharedLetters(transaction,dictum) returns "tci" SharedLetters(Transaction,kudzu) returns "" If "transaction" is stored in wordArray[12] and "dictum" is stored in wordArray[33] then wordsIntersect[12][33] will contain "tci" if "kudzu" is stored in wordArray[78] then wordsIntersect[12][78] will contain "" wordlist.txt assuaged apothecary taciturn chattel unsullied dictum strictures dispatched ambled detention dispatched detachment repertoire malevolent vapid morbid nocturnal stealthy mutilated predilection domiciled flivver intimidation nebulous transition concession condescended foray transaction apprehensively indigenous seceded catawba cunning literate illicitly sentimentality union suit entailment scrip stamps vexations hilt subsequent mortification similax uninitiated sojourn onslaught speculation dispensation irked cordially expounding erratic tranquility retrieved sprint iniquities flinty persevere furor contentious condescension contemptuous diminutive dispersed fraught monosyllabic fractious amiable crackling bread compromise disapprobation compromise gravely aloft auspicious evolved expended fruitless wrought tyranny unanimous scuppernongs ethical arbitrated palette skeetered reluctantly mortifying ritual phenomena immune parceled Gothic melancholy evasion quelling tacit magisterial benevolence communion incomprehensible inquisitive asinine edification quibbling kudzu prowess ramshackle eerily dismemberment malignant lattice pilgrimage desolate delete honed ascertaining cleaved rendered meditative unfathomable Rosetta Stone aberrations touchous Appomattox meteorological torso perpetrated libel caricatures hermaphrodite morphodite direst shambles perplexity gastric inordinately uncompromising lineaments ingenuous diversions analogous changelings ingenuous fluently provocation deportment mortify prey obstreperous gallantly tenterhooks invective feeble inconspicuous contemporaries rudiments Providence mausoleum peril sprinted foliage alist simultaneous articulate jubilantly interrogate wrathful ruthless interrogation melancholy vicious apoplectic decreed miniature sequins obscurely scuppernong contradict arthritic philippic degeneration premise umbrage assessment acquisition grimy rectitude guff tranquil disposition interdict flailing rectitude shrieking skulked palliation geological inaudible contemporaries inexcusable vacated relic antagonized compassion essence entitled reconnaissance calomel delicately padded oppressive tirade commence glistened protruded nether undulate viscous emerged propensities infuriated usage plough moats devoid detached blood-curdling morphine addict escapade beholden distraction bailing cantankerous inconsistent appalling pestering consulted alien altercation fret boded compensation emerge barnacles diligently frivolous trooped persisting habiliments chunks denoted asafoetida clad contemptuously indignantly amusement mass contentious haughty unceiled proclaimed rotogravure ecclesiastical impediments garish indecision ethics innate subdued rumble artillery lingered decree murmur Deity forthright denunciation austere confronted preoccupy erected spite deposited propelled customary voile tedious thunderstruck dawned novel aggravates phantom enarmored uncompromising permanence chauffeur tidiness sluggish extract giddy flared formidable dispelled affirmative delicacies sustain Amanuensis objective prerogative morbid flighty heredity preoccupation obliquely thrived nimble-wittedness tranquility dispatched confines devoid sprawled myopic grubbiness proportion vetted maneuver Reconstruction resemblance caste dicta discreet changelings mandrake roots abstract speculations fidgeting inflection breeding elusive curtness isolation crackle allergic squirm dumpy obscure carnal shred penitentiary retreated taut antagonize rankling formerly edification stance gouging brawl adjoining resilient coiled negligee tentative reverent emerge perish devoured narrative ventilator manacles infallible scrub flickered erosion traitor riot civil diction defendant placid foolproof postponement begrudge glee venue inaudible ominous subjected crisis evaluation criteria pronouncement interval linotype prevailed composed prohibited poke affliction hitching rail peered venerable miniature Gothic battlements buttresses facade ecclesiastical wedged detractors oblivious aspect succinct shrieked lingering acquiescence defiance burly justification prospects sullen-looking aggregation uncouth idiocy impassive ramshackle husky encumbered pace fey disorderly lurched Mennonites Prohibition akimbo subpoena elucidate dispel solicitor multitudes unobtrusive equity controversy eccentricities connivance extracted litigants scrutiny corresponding scampered corroborating amiably turbulent fluctuations prosperity congenital indigenous corrugated gleaning aromas acrimonious benignly audibly obscene dictum smugly complacently tenet pantomime ambidextrous lavations chiffarobe mollified perpetual chronic neutrality pilgrimage involuntary arid detached constructionist severed spittoon exodus induced volition collective predicament unimpaired ex cathedra misdemeanor expunge impudent discreet perpetrated fraud corroborative indicted detachment equivalent subsequent contraband aridity circumstantial exclusively unmitigated temerity cynical caliber distaff acquit remorse vengeance tacit demurred resumed scurry ignite tranquil impassive bleakly posed heaved colleagues feral fatalistic ruefully heathen obscure prompted exclusively pursuits shred credibility grudge furtive commutes capital adamant penalty stolidly vehement sordid wrathfully inevitable droned disastrous resolve absorbed tactics infantile hieroglyphic charlotte squalid communal adjourned apprehension impertinence duress devout conception squalor largo sulky bellows replenishing sibilant bovine undelectable instinctively tribute humility martyred assurances scampered obituary miscarriages slaughter demise twinge recluse collards compelled era profound feeble-minded persecute maniac mused unique annals savored metaphors florid nondescript crooning assault harbor utmost stealthily purloined contraption repertoire gait furtive lectern frenzied ghoul alleged enterprises rustic persevered ascertain subordinates floundering pinioned staccato hexagonal untrammeled declined pulp perforated tussled reprimand garishly indentations astounded eluded blunt deceased audible honed disengaged raling hovered accommodate apprehensive acquiescence

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

ISBN: 061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago