CS32 C++ programming

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.

相关推荐

  1. CS32 C++ programming

    2024-04-22 20:40:04       33 阅读
  2. object oriented programming CS32

    2024-04-22 20:40:04       32 阅读
  3. day<span style='color:red;'>32</span>_<span style='color:red;'>CSS</span>

    day32_CSS

    2024-04-22 20:40:04      49 阅读
  4. day<span style='color:red;'>31</span>_<span style='color:red;'>CSS</span>

    day31_CSS

    2024-04-22 20:40:04      43 阅读
  5. 沁恒CH32V30X学习笔记10---pwm输出

    2024-04-22 20:40:04       46 阅读
  6. 沁恒CH32V30X学习笔记04--外部中断

    2024-04-22 20:40:04       51 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-22 20:40:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-22 20:40:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-22 20:40:04       87 阅读
  4. Python语言-面向对象

    2024-04-22 20:40:04       96 阅读

热门阅读

  1. LeetCode-94-二叉树的中序遍历

    2024-04-22 20:40:04       28 阅读
  2. springboot接口提高查询速度方法

    2024-04-22 20:40:04       39 阅读
  3. 分治法构建Gray码问题

    2024-04-22 20:40:04       36 阅读
  4. 深入理解与运用Vue 2中的插槽(Slots)

    2024-04-22 20:40:04       36 阅读
  5. 测试testing1

    2024-04-22 20:40:04       30 阅读
  6. Mysql多表联查使用聚合函数常见问题

    2024-04-22 20:40:04       31 阅读
  7. 第七周笔记

    2024-04-22 20:40:04       30 阅读
  8. MySQL运维故障排查与高效解决方案

    2024-04-22 20:40:04       36 阅读
  9. 机器学习笔记 - torch.hub 和 torchvision.models 的区别

    2024-04-22 20:40:04       33 阅读
  10. MySQL运维故障解决方案:实战案例与深度解析

    2024-04-22 20:40:04       32 阅读
  11. JWT原理

    JWT原理

    2024-04-22 20:40:04      37 阅读
  12. Docker - 网络

    2024-04-22 20:40:04       32 阅读
  13. MySQL无法远程连接方案解决(示例)

    2024-04-22 20:40:04       38 阅读
  14. 卸载jenkins和docker

    2024-04-22 20:40:04       35 阅读
  15. 算法=问题的解决方法

    2024-04-22 20:40:04       39 阅读
  16. Unity中Socket,Tcp,Udp网络连接协议总结

    2024-04-22 20:40:04       29 阅读
  17. 浅谈薪酬绩效设计及运行的忌讳

    2024-04-22 20:40:04       38 阅读