CS32 C++ programming

server/2024/12/22 20:44:59/
Here’s another random fact that I’m going to share about myself. I went to North  Hollywood High School (NHHS) Highly Gifted Magnet (HGM) for school. You probably are wondering what is a Highly Gifted Magnet and how does one get there? You take  an IQ test and if you get at least a 150 (which is genius level), you are eligible to get in.
Believe it or not, at one point, I tested to that level. (That is probably before all of these adult beverages got into my system, probably lowering that mark. =]) Well, the reason I mention this is because we recently just celebrated our 25 year class reunion! Twentyfive years is more time than some of you reading this have been alive, which makes me a fossil to you at this point. (Yes, your professor has jokes and is self-deprecating. =])
The thing about a reunion is that it is a big game of trying to figure out who is doing what now, what happened to a certain person, and what are the stories and memories that you take from that time. It’s a fun game indeed.
There are also other games that you can play. Take word games, like Scrabble and Words with Friends, that require rearranging a combination of letters to make a word.
This type of arrangement is generally referred to as an anagram, while it's known as a permutation in mathematics. This assignment will give you some experience thinking about and writing recursive functions. Write a C++ program that searches for "anagrams" in a dictionary. An anagram is a word obtained by scrambling the letters of  some string. For example, the word "pot'' is an anagram of the string "otp." A sample run of the program is given below. Your output does not have to be formatted exactly the same as that shown in the sample, but it should be in a similar style. You can use words.txt as your dictionary file and anagrams.cpp as an example of a main program.
Since the purpose of this assignment is to give you experience using recursion, you may not use any of C++'s iteration constructs ( do , while , for , and goto ) or any STL algorithms (if you have no idea what this means, you're OK). In fact, similar to homework #2, you may only use the substr() and size()/length() functions in the string class. All repetition must be accomplished using recursion. This applies to every  operation in the program, even file operations. Obviously, you would never write a program like this in industry but as an exercise it should be useful to gain experience
with recursion.
Sample Runs
Here are two examples of how the program might work:
Please enter a string for an anagram: rat
Matching word art
Matching word rat
Matching word tar
Please enter a string for an anagram: regardless
No matches found
Requirements
You must write these three functions with the exact same function signature (include  case):
int vocabularyCreator(istream &dictfile, string dict[]);
Puts each string in dictfile into the array dict . Returns the number of words
read into dict . This number should not be larger than MAXDICTWORDS since that is the size of the array.
int potentialSequences(string word, const string dict[], int
size, string results[]);
Puts all the possibilities of word which are found in dict into results . Returns
the number of matched words found. This number should not be larger than
MAXRESULTS since that is the size of the array. The size is the number of words inside the dict array.
void outcomeDisclosure(const string results[], int size);
Displays size number of strings from results . The results can be printed in
any order.

http://www.ppmy.cn/server/8979.html

相关文章

在Vue3中如何使用H.265视频流媒体播放器EasyPlayer.js?

H5无插件流媒体播放器EasyPlayer属于一款高效、精炼、稳定且免费的流媒体播放器,可支持多种流媒体协议播放,可支持H.264与H.265编码格式,性能稳定、播放流畅,能支持WebSocket-FLV、HTTP-FLV,HLS(m3u8&#…

JAVA学习笔记29(集合)

1.集合 ​ *集合分为:单列集合、双列集合 ​ *Collection 接口有两个重要子接口 List Set,实现子类为单列集合 ​ *Map接口实现子类为双列集合,存放的King–Value ​ *集合体系图 1.1 Collection接口 1.接口实现类特点 1.collection实现…

CSS3 新增的新特性

一、是什么 css,即层叠样式表(Cascading Style Sheets)的简称,是一种标记语言,由浏览器解释执行用来使页面变得更美观 css3是css的最新标准,是向后兼容的,CSS1/2 的特性在 CSS3 里都是可以使用…

产品推荐 | 基于XILINX VERSAL的XW-NVME-X16-2SAS智能FPGA加速卡

01 产品概述 XW-NVME-X16-2SAS智能存储加速卡基于XILINX VERSAL ACAP MPSOC,EP侧提供1路PCIe GEN4 x16接口,RP侧最大可支持2路PCIe GEN4 x8,或4路PCIe GEN4 x 4,板载DDR4-3200MHz缓存,具有低延迟、高性能、低能耗、低…

1688官方API商品数据采集接口|阿里巴巴中国站获得1688商品详情 API 返回值说明

随着全球经济一体化和电子商务的快速发展,网络购物的需求日益增加。不断涌现的电商企业使得行业的竞争情况愈演愈烈。在这种情况下,企业不仅要加大经营力度,还要在自己的基础设施和技术上持续投入,才能更好的适应市场和消费习惯。…

qt windeployqt

有时候动态库 Qt5Xmld. dll 是1.79MB的合适 有时候是324kb的合适 不会报错 应该是qt编译版本的问题

操作系统——进程

进程定义 是计算机中已经运行的程序是系统进行资源分配和调度的一个独立单位。 进程的特性 独立性:进程在内存中可以独立寻址,每个进程都有一个独立的堆栈空间。动态性:进程在执行过程中可以申请资源、使用资源、释放资源。并发性&#xf…

国产台灯哪个品牌比较好?五款国产护眼台灯品牌推荐

随着学生们重返校园,家长和孩子们忙于新学期的准备工作,眼睛健康的考量自然也在其中。这也是为何近年来护眼台灯越来越受到欢迎的原因之一。国产台灯哪个品牌比较好?作为一个长期近视并且日常用眼时间较长的人,我本人对护眼台灯有…