-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
39 lines (36 loc) · 799 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <fstream>
using namespace std;
bool prime(int);
int main()
{
ifstream myFile;
myFile.open("secret.txt");
int out[100000];
int i = 0;
if (myFile.is_open())
{
while (!(myFile.eof()))
{
myFile >> out[i];
i++;
if ( i >=15000) break;
}
for (int i = 0; i < 15000; i++)
{
int character = out[i];
if (prime(character))
if ((character <= 90&&character>=65) || (character <=122 && character>=97) || character == ' ')
cout << (char)character;
}
}
}
bool prime(int a)
{
if (a<=1)
return false;
for (int i = 2; i < a; i++)
if (a%i == 0)
return false;
return true;
}