rescr1pt
33 / 34 / 1
Регистрация: 03.10.2011
Сообщений: 61
|
05.12.2013, 15:37
|
|
Можно так
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 <iostream>
#include <string>
#include <fstream>
using namespace std;
int main ()
{
std::ifstream ifs ("input.txt", std::ifstream::in);
if (!ifs.is_open())
{
cout << "File not found!";
cin.get();
return -1;
}
string source;
char c = ifs.get();
while (ifs.good())
{
source.push_back(c);
c = ifs.get();
}
if (source.size() < 15)
cout << "Must be greater then 15!\n";
else
{
string last = source.substr(source.size()-15, source.size());
cout << last << endl;
}
// pause
cin.get();
} |
|
1
|