I am fairly new to c++ and have been working on this problem and asked the professor for help, but he has really been non-compliant. I am lost on this and keep gettin error messages that I do not understand how to fix. Any help that could be given would be absolutely great, thanks!
Copy the following code exactly as shown. Starting with the following code base, add code in the area shown to create a function called printAllFactors. Do not change any of the other code anywhere else in the program! Write only one function (not two). You must write your own function – do not use a library function. If you break any of these rules you will get a zero for this question! Remember that a factor is any number that divides into another number without any remainders. For example, the factors of 8 are: 4 2 1. Use the screen shots below as a guide.
#include <iostream>
using namespace std;
// Do NOT change anything ABOVE HERE
// WRITE THE FUNCTION BETWEEN HERE
// AND HERE
// Do NOT change anything BELOW HERE
int main()
{
int i1, i2;
cout << "Enter an integer: ";
cin >> i1;
printAllFactors(i1);
cout << "Enter another integer: ";
cin >> i2;
printAllFactors(i2);
}
#include <iostream>
using namespace std;
class dic(object)
{
def printAllFactors(self,x)
while (x)
{
if (x %2 == 0)
{
print x
x /= 2
if (x == 1)
{
print x
break
}
}
else
{
print x
break
}
}
return (printAllFactors)
}
int main()
{
int i1, i2;
cout << "enter an integer: ";
cin >> i1;
printAllFactors(i1);
cout << "enter another integer: ";
cin >> i2;
printAllFactors(i2);
}