Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that generates all the factors of a number entered by the user.

ID: 1798851 • Letter: W

Question

Write a program that generates all the factors of a number entered by the user. For instance, the number 12 has the factors 2 * 2 * 3. This program has the following requirements:

I was able, with the help of a few folks from here, to write the above program in the following C++ code:

#include <iostream>
using namespace std;
int main()
{
int popA, popB;
double rateA, rateB;
int years=0;
cout<<"Enter population of Dogville: ";
cin>>popA;
cout<<"Enter growth rate of Dogville: ";
cin>>rateA;
cout<<"Enter population of Cattown: ";
cin>>popB;
cout<<"Enter growth rate of Cattown: ";
cin>>rateB;

while(popA<popB)
{
popA=(int)(popA*rateA+popA);
popB=(int)(popB*rateB+popB);
years++;
cout<<"Year Dogville Cattown ";
cout<<years<<" "<<popA<<" "<<popB<<endl;
}
rateA/=100.;
rateB/=100.;

system("pause");
return 0;
}

It works great for the first year figures. What would I need to add to make it calculate the growth for year 2, year 3, and year 4?? Please help.....

Explanation / Answer

#include using namespace std; int main() { int num; cin>>num; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote