Consider the below code. #include using namespace std; class Count { public: int count; }; Count(int c) { count C; } Count() { } count = 0; void increment (Count c, int times) { c.count++; times++; } int main() { } Count myCount; int times 0; - for (int i = 0; i < 100; i++) increment (myCount, times); cout << "myCount.count is << myCount. cout << times is << times; return 0; ** a. What is the printout of the above code? b. If the highlighted code above is changed to void increment(Count& c, int times) what will be the printout? . If the highlighted code above is changed to void increment(Count& c, int& times) what will be the printout? d. Can you change the highlighted code above to the following? void increment(const Count& c, int times)
Consider the below code. #include using namespace std; class Count { public: int count; }; Count(int c) { count C; } Count() { } count = 0; void increment (Count c, int times) { c.count++; times++; } int main() { } Count myCount; int times 0; - for (int i = 0; i < 100; i++) increment (myCount, times); cout << "myCount.count is << myCount. cout << times is << times; return 0; ** a. What is the printout of the above code? b. If the highlighted code above is changed to void increment(Count& c, int times) what will be the printout? . If the highlighted code above is changed to void increment(Count& c, int& times) what will be the printout? d. Can you change the highlighted code above to the following? void increment(const Count& c, int times)
Related questions
Question

Transcribed Image Text:Consider the below code.
#include <iostream>
using namespace std;
class Count
{
public:
int count;
};
Count(int c)
{
}
}
count= c;
Count()
count = 0;
void increment (Count c, int times)
{
c.count++;
times++;
}
int main()
{
}
Count myCount;
int times= 0;
for (int i=0; i<100; i++)
increment (myCount, times);
cout << "myCount.count is " << myCount.count;
cout << times is " << times;
return 0;
a. What is the printout of the above code?
b. If the highlighted code above is changed to
void increment(Count& c, int times)
what will be the printout?
c. If the highlighted code above is changed to
void increment(Count& c, int& times)
RE
what will be the printout?
d. Can you change the highlighted code above to the following?
void increment(const Count& c, int times)
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 now
This is a popular solution!
Step by step
Solved in 5 steps
