-
-
Save pithonsmear/5477912532be67d1926271091214730c to your computer and use it in GitHub Desktop.
updated main for chapter04_ex11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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