Ive just started learning c++ and I've been working on writing a program for over a week now, at this point I've pretty much lost hope and have no clue what to do. Im trying to write a program that will list out numbers 1-50 along with their factors and whether they are prime or not, so basically Im trying to create a sieve of erathsothenes thing that will predict whether the numbers are prime or not, and do it with the basic stuff like loops and if statements, ect..does anyone have any suggestions?

this is how far ive gotten:....

Code:#include <iostream> #include <math.h> double numb; double factor; double leftover; double numoffactors; int main() { using namespace std; cout << "Number Factor Prime or Not" << endl; cout<< " ------------------------------------------"<< endl; cout<< " 1 doesn't count Not Prime "<< endl; cout.width(10); for(int numb=2;numb <=20;numb++) { cout << numb << endl; cout.width(19); cout<< factor<<endl; cout.width(39); cout<<leftover<<endl; } for(int factor = 2;factor<=20;factor++) while (numb>factor) { leftover= fmod(numb,factor); } if(leftover == 0) { numoffactors = (factor + 1); } else { numoffactors=1; } if(numoffactors < 2) { cout.width(35); cout << "Prime" << endl; } if(numoffactors > 2) { cout.width(35); cout << "Not Prime" << endl; } return 0; }