Prime Number Function

Trying to make a program with functions that determine if a number is prime or not.

New to code and never used functions before, what is wrong and what should I do?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
   
//CSC150 Lab6
//Cleveland Redd
//October 23, 2015

#include <iostream>
using namespace std;
bool is_prime (int n);
int main( )
{
    int n;
cout<< "Enter a number";
cin>> n;
bool is_prime(int n)
  {
      for (int i=2; i<=n/2 i++)
    if (n==0 || n ==1)
    {
        return 1;
    }

    else
    {
        while(n%count!=0)
    }
  }
  return 0;
} 
- You cant define a function inside another function.
- Your while loop doesn't have a body (it is not repeating anything).
Thanks Kevin C i figured it out shortly later last night.. This website actually works i'm have to make more use of it!
Topic archived. No new replies allowed.