I need to place an if/then statement in this code that outputs that the number factored will return a negative result and for the code to not factor that number. Any suggestions will be greatly appreciated!!
Thanks,
Bill
//*************************************
#include <iostream>
#include <cmath>
using namespace std;
int count = 0; //Initialize the event counter.
int sum = 1; //Initialize the sum.
int number; //Used for reading.
int main()
{
while (count = 0);
{
cout << " Enter the number you want to factor : " << endl;
cin >> number; //Get the input number.
This line: while (count = 0);, should probably be: while (count == 0);.
= is for assignment, == is for comparison.
There are many other odd things about that while such as the semicolon and that counter will always be equal to zero
It's also interesting that the program asks for a number just before closing