GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Starting with an empty Map of characters to integers named c…

Starting with an empty Map of characters to integers named cmap, suppose the following operations are performed: (Bonus Points: This question has 3 bonus points for a total of 3+3 = 6. Added later manually when graded by instructor). map cmap;    string seq = “ohio”;    int i = 0;    while (i < seq.length())    {        cmap[seq.at(i)]=0;        int count = cmap[seq.at(i)];        cmap[seq.at(i)]=count+1;        i = i + 1;    } for (auto& x: cmap) { cout

Read Details

Provide your answers based on the following functions….

Provide your answers based on the following functions. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 void mystery(int &x){ x += 1; } void mystery(int &x, int y){ y += 1; x = y * 2; } int main(){ int number = 1; mystery(number); cout

Read Details

Using the function template below, type a working function. …

Using the function template below, type a working function.  Make sure your function conforms to the instructions given in the comments for the function. [Note: Include the function header in you answer, you don’t need to copy the comment section in your response] /*_____________ fooSolver(______________________)This method should take as parameters two Maps that contain the contact information of neighbors and must return a new map with the updated info of both maps.Each map stores a name (string) as a key and an email (string) as a value.Emails must not be duplicated in the resulting map. The information in map1 prevails if the same name exists in both maps (most recent), otherwise copy from map2 (oldest emails) the customer’s email that is missing.For example, if the Map1 (recent emails) contains:{{“John Adams”, “adams@postoffice.usa”}, {“Ben Franklin”, “ben@postoffice.usa”}}and Map2 (older emails ) contains:{{“Thomas Jefferson”, “box2@postoffice.usa”}, {“John Adams”, “box3@postoffice.usa”}, {“Ben Franklin”, ” box1@postoffice.usa”}} would cause the method to return the map:{{“John Adams”, “adams@postoffice.usa”}, {“Ben Franklin”, “ben@postoffice.usa”}, {“Thomas Jefferson”, “box2@postoffice.usa”}}Assume that names are correctly spelled, capitalized and emails are correctly entered without missing characters.The original Maps must NOT be changed by this method.  */________________ fooSolver ( ______________________________________){}

Read Details

The following code segment will be used for the next 5 quest…

The following code segment will be used for the next 5 questions . The code in the class Bar is complete, and main ()  contains only a partially completed main method (in other words there are no additional functions in the class Bar, but there could be more code in the main method) . NOTE: be aware that some of these questions may have more than one correct answer listed – you should mark ALL that apply in these cases: class Bar : public Foo {    private:        int integer1;        list list1;    public:        Bar()        {            integer1 = -1;        }        void enigma(int x)        {            list1.push_back(x);            integer1 = integer1 + 1;        }        int mystery()        {            integer1=integer1-1;            int val = list1.front();            list1.pop_front();            return val;        }        bool riddle()        {            return (integer1

Read Details

How to create a dynamic array of n character pointers? Assum…

How to create a dynamic array of n character pointers? Assume n is a previously-declared integer variable and holds a positive value.

Read Details

In the code above, what value is displayed by the code state…

In the code above, what value is displayed by the code statement marked with line (1)?

Read Details

We have the following class: 1 2 3 4 5 6 7 8 9 10 11…

We have the following class: 1 2 3 4 5 6 7 8 9 10 11 #include using namespace std; class Test{ public: void print(); }; void Test::print(){ cout

Read Details

If a function is friend of a class, which one of the followi…

If a function is friend of a class, which one of the following is FALSE?

Read Details

Modify the Matrix class provided below and give the definiti…

Modify the Matrix class provided below and give the definition of a template Matrix class, so that the template Matrix class has the same functions as the above definition for integers, but can be used to store elements of any given data type.    You do not need to implement any member function. Analyze which lines you need to modify: enter the line number to modify as well as the letter option for the new line of code, from the options given below, to modify the class and make it a template. Enter only the lines that must be modified and the new code. Go in order. If there are left some Lines unused, enter empty as shown. Example of modifying a line: Line: 4        code:  B        Example of unused lines: Line: none code: N: empty (No code) Enter your answers: Line: [line1]    code:[code1] Line: [line1a]  code:[code1a] Line: [line2]    code:[code2] Line: [line3]    code:[code3] Line: [line4]    code:[code4] Line: [line5]    code:[code5]

Read Details

Complete the following code segment, to print all elements…

Complete the following code segment, to print all elements in the vector v, from beginning to end. 1 2 3 4 vector v{1,2,3,4,5}; vector::iterator it; for (it=/*blank 1*/; it!=/*blank 2*/; /*blank 3*/;) cout

Read Details

Posts pagination

Newer posts 1 … 31,006 31,007 31,008 31,009 31,010 … 82,113 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top