Hey all, I am writing a program that computes prime numbers. I get the following error message when I try to build.
I've tried the other logical operators (||, !) but they generate the same error. If I delete the logical operator and the 2nd part of the condition the code works perfectly fine. Please note I know that my algorithm is probably flawed but I want to figure those flaws out myself so please do not correct my algorithm.|24|error: expected identifier before '(' token|
Thanks in advance for any helpCode:#include <iostream> #include "LargeNumber.h" #include <stdexcept> using namespace std; int value; int a_prime_number; int divider; int analyzer; int stop_value; int main() { cout << "What number would you like to start with?(Must be greater than 1)\n"; cin >> value; cout << "What number would you like to stop at?(must be larger than start value)\n"; cin >> stop_value; cout << "Starting calculations, this will take a while\n"; while ( value < stop_value ) { divider = 2; analyzer = value % divider; if (0 == analyzer) && (value <= divider) { cout << "## Debug message1\n"; ++value; } else if ( value <= divider ) { cout << "## Debug message2\n"; a_prime_number = value; cout << a_prime_number << "\n"; } { cout << "## Debug message4\n"; ++divider; } } cout << "Done\n"; cin.ignore(numeric_limits<streamsize>::max(), '\n'); cin.get(); }



LinkBack URL
About LinkBacks


