Just tried to make a quick prime number checker:

#include <iostream>
#include <cmath>
using namespace std;

void askForNumber();
bool checkPrime();
void printPrime();
void printNotPrime();

int numberEntered;
int x = 2;
bool isPrime = true;

int main(){
    if(checkPrime(numberEntered) == true){
    return 0;

void askForNumber(){
     cout << "Enter a number to see if it is prime: ";
     cin >> numberEntered;

bool checkPrime(int enteredNumber){
     while(x < sqrt(enteredNumber)){
             if(enteredNumber % x == 0 && enteredNumber != x){
                 return false;

void printPrime(){
     cout << numberEntered << " is prime!";

void printNotPrime(){
     cout << numberEntered << " is not prime.";

I don't need help making it work, just the errors I get at line 6 and 16:

6: 'too many arguments to function `bool checkPrime()'
16: 'at this point in file'


The function declaration and the function don't match. The function takes a parameter, but the function declaration says it doesn't. Copy line 30 to line 6. Lines 6, 16, and 30 need to match each other as far as the parameters the function takes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.