Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string>
- #include <sstream>
- using namespace std;
- int main()
- {
- ifstream in("INPUT.txt");
- ofstream out("OUTPUT.txt");
- unsigned a;
- string sum("7182818284590452353602875");
- in >> a;
- if(a == 0)
- out << 3;
- else
- {
- int temp, temp2;
- string str = sum.substr(a,1);
- string str2 = sum.substr(a-1,1);
- stringstream stream(str);
- stream >> temp >> str;
- stringstream stream2(str2);
- stream2 >> temp2 >> str2;
- if(temp >= 5 && a!=sum.size())
- {
- temp2++;
- ostringstream stream3;
- stream3 << temp2;
- str = stream3.str();
- sum.replace(a-1,1,str);
- }
- sum.erase(a,sum.size());
- out << "2." << sum;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement