Skip to content

Instantly share code, notes, and snippets.

@pithonsmear
Created January 16, 2017 02:21
Show Gist options
  • Save pithonsmear/5477912532be67d1926271091214730c to your computer and use it in GitHub Desktop.
Save pithonsmear/5477912532be67d1926271091214730c to your computer and use it in GitHub Desktop.
updated main for chapter04_ex11
int main() {
cout << "How many primes should I find?\n";
int n_primes = 0;
cin >> n_primes;
primes_norm.push_back(2);
int i = 3;
while (primes_norm.size() < n_primes) {
if (is_prime(i)) {
primes_norm.push_back(i);
}
i+=2;
}
for (int j=0; j<primes_norm.size(); j++) {
cout<<primes_norm[j]<<endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment