I'm in a first level compsci class in college and the teacher is horrible. I have no idea what I am supposed to do in this program where
"Your program is to accept a series of positive integers, and determine the prime factors that would multiply that integer. In addition, it is to tell the user if the input was actually prime. "
We are supposed to use while loops I believe, along with if/else statements I am assuming.
What I have so far I know is completely incorrect. If anyone could please guide me to this program, it would be really awesome!!! Thank you
#include <iostream>
usingnamespace std;
int main()
{
int input; // an input value to be used for calculations
int counter1;
int product;
cout << "Please enter a positive integer" << endl;
cin >> input;
counter1 = 2;
while(counter1 <= input){
counter1 = counter1++;
}
if(input % counter1 == 0){
cout << counter1 << "is a prime number";}
else{cout<< "not a prime number";
}
return 0;
}
Sounds pretty straightforward to me. Program should accept input integers, and for each integer give the prime factors. Note, every integer is either a prime number or a product of prime numbers.