Find the Errors
Each of the following declarations, programs, and program segments has errors. Locate as many as you can.
A) #include <iostream>
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;
}
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.