
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Please complete the following functions:
PLEASE USE
I will upvote if correct.

Transcribed Image Text:#include <iostream>
#include <fstream>
#include <istream>
#include <string>
#include <vector>
using namespace std;
// Max matches that can be found
const int MAXDICTWORDS = 30000; // Max words that can be read in
const int MAXRESULTS = 20;
int loadDictionary(istream& dictfile, vector<string>& dict)
/*Places each string in dictfile into the vector
dict. Returns the number of words loaded into dict.*/
{
return -1; // This compiles, but this is incorrect
}
int permute(string word, vector<string>& dict, vector<string>& results)
/* Places all the permutations of word,
which are found in dict into results. Returns
thenumber of matched words found.*/
{
return -1; // This compiles, but this is incorrect
}
void display(vector<string>& results)
/* Displays size number of strings from results.
The results can be printed in any
order.*/
{
return; // This compiles, but this is incorrect
}
int main()
{
vector<string> results(MAXRESULTS);
vector<string> dict(MAXDICTWORDS);
ifstream dictfile;
int nwords;
// file containing the list of words
// number of words read from dictionary
string word;
dictfile.open ("words.txt");
if (!dictfile) {
cout << "File not found!" << endl;
return (1);
}
nwords = loadDictionary(dictfile, dict);
dictfile.close();
cout << "Please enter a string for an anagram: ";
cin >> word;
int numMatches = permute (word, dict, results);
if (!numMatches)
cout << "No matches found" << endl;
else
display(results);
return 0;
}|
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 4 images

Knowledge Booster
Similar questions
- *Part A and B important. The functions are just examples. A. Write a function called getDimension() that asks the user inputs for the dimensions that consists of twovalues: row and column, then return it to the mainline (also known as global scope) of the program. Therange of the dimensions that the user can input is from 4 to 10 for both rows and columns Please referto the gameplay sample. B. Next, use a 2-dimensional list to represent the game board, where each cell can be either empty(represented by a space " "), a token belonging to human (represented by "X"), or a token belonging tocomputer (represented by "O") as shown in Table 1. Write a function called printBoard(board) thattakes a 2-dimensional list representing the game board and prints it to the console functions: 1) dropToken (board, col, token): takes a 2-dimensional list representing the game board, acolumn number, and a token (either "X" or "O") and returns the row number of the placed token.This function places the…arrow_forwardPLEASE TYPE ONLY**** 25 horses - we need to find the fastest 3 in correct order 1st,2nd and 3deach race consists of 5 horses - how many races you need , explain solution.arrow_forwardCells B1, C1, and D1 contain the values Seat1Row1, Seat2Row1, and Seat3Row1. If cells B1, C1, and D1 were selected, and autofill used to fill E1, F1, and G1, what would be the auto-filled values?arrow_forward
- 1.)Use the find function and the and & operator to find the indexes of all the values in this vector that are greater than one and less than ten. Put your results in a variable named indexes [3, -4, 0, 1.23, 17, 0, -2, 0] Your solution ought to look something like: indexes = 1 4 2.)Extend the previous question to use the vector of indexes that you found to create a new vector of the values that are greater than one and less than ten. In other words, your answer should be [3, 1.23] but you need to turn in code that identifies these values using the vector of indexes from question 1.arrow_forwardQI/A In the matrix S (3*3)Write a program to enter random matrix and find the summation of even numbers (SE) and the summation of odd numbers (SO) print the result.arrow_forwardUnique answer onlyarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY