Problem

Find the Errors Each of the following declarations, programs, and program segment...

Find the Errors

Each of the following declarations, programs, and program segments has errors. Locate as many as you can.

A) #include

using namespace std;

class DumbBell;

{

int weight;

public:

void setWeight(int);

};

void setWeight(int w)

{ weight = w; }

int main()

{

DumBell bar;

DumbBell.setWeight(200);

cout << "The weight is " << bar.weight << endl;

return 0;

}

B) class Change

{

private:

int pennies;

int nickels;

int dimes;

int quarters;

Change()

{ pennies = nickels = dimes = quarters = 0; }

Change(int p = 100, int n = 50, d = 50, q = 25);

};

void Change::Change(int p, int n, d, q)

{

pennies = p;

nickels = n;

dimes = d;

quarters = q;

}

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT