look guys I don't need somebody to do my work for me, heres the program I already turned in listing all the prime numbers from 2 - 997.
#include<iostream>
#include<iomanip>
#include<cmath>
usingnamespace std;
int main()
{
double prime;
int count;
int remainder;
int LHu;
LHu = 0;
for(prime = 2; prime <= 1000; prime++)
{
remainder = prime;
for(count = 2; count <= sqrt(prime); count++)
{
int (prime) % count ?0: (remainder = 0);
}
if (remainder != 0)
{
//if......else to get 5 numbers on a line
LHu++;
if (LHu % 5 == 0)
{
cout << setw(6) << prime <<
" " << endl;
}
else
{
cout << setw(6) << prime <<
" ";
}
}
}
return 0;
}
All I was asking for is a little advice in how to setup my algorithm, I can do the code. I am a straight A student (3.871), I made an A in this class in the summer, just with a lot easier teacher. I have never had to learn about prime numbers. I am more interested in learning about functions, parameters, arrays, structs, classes, etc. I could care less about prime numbers, and how to find all even numbers in existence and have two prime numbers that equal them. Is prime number excellence a part of C++.
Anyways thanks for your help with my algorithm.
Can somebody just tell me the steps necessary.
Like, for example:
1. get the prime numbers
2. get even numbers
3. find two prime numbers that equal each and every even number known to man
4. print the pairs out (11,13) (3,23) etc.
5. clap your hands cause you did a good job
6. etc.
I don't think I could do this with a paper and pencil, oh well, its only worth like 4% of our grade, and with the curves he gives, don't give me any hints, its ok. After all, I've only put in 5 or 6 hours on trying to find a good algorithm. But that does sound like good advice, break down the problem into little pieces, compile often, etc. Unfortunately, my teacher already told us that on the first day of class.