@Sylar9
134 / 55 / 2
Регистрация: 04.09.2011
Сообщений: 1,952
|
05.06.2012, 18:56
[ТС]
|
|

Сообщение от Кот Ангенс
Очевидно, Вы не удалили свою функцию.
удалил, вот код
C++ | 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
| #include <vector>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int prost(int);
int main()
{
vector <int> v;
int temp;
bool x;
while(cin >> temp)
{
x = prost(temp);
if(x)
v.push_back(temp);
}
sort(v.begin(), v.end());
for (int i=0; i<v.size(); i++)
cout << "v[" << i << "]= " << v[i] << endl;
system("pause");
return 0;
}
int prost(int x)
{
for (int i = sqrt(x); i > 1; i--)
if (!(x % i))
return false;
else
return true;
} |
|
0
|