I just started using C++ no more than a week ago. I have to write a program that solves Goldbach's conjecture (Wikipedia provides a simple overview if you don't know what this is), but since my program will be dealing mostly will smaller values, speed and efficiency aren't of the highest importance. I have found codes that are already written online, but I need to come up with one of my own. So far, this is what I have written:

This program takes the value that is entered and splits it into as many pairs as possible that add up to the original input. Is there a way for me to limit this so that only the pairs containing two primes appear? Or if this is not possible, what else should I do? Remember, this doesn't have to very fast or that efficient.Code:#include <iostream> using namespace std; int main () { long int x; int a,b; cout << "Enter the number: "; cin >> x; cout << endl; if (x<=2) { cerr << "Goldbach's conjecture only works for even integers greater than 2. "; cout << endl; cout << endl; return 0; } if ((x%2)!=0) { cerr << "Goldbach's conjecture only works for even integers. "; cout << endl; cout << endl; return 0; } for (a=2; a<=x; a++) { for (b=2; b<=x; b++) { if ((x>2) && ((x%2)==0) && (a<=b) && (a+b==x)){ cout << a << " and " << b << endl; } } } return 0; }

Thanks for reading.