Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
408 B
1
Indexable
Never
#include<iostream>
using namespace std;

int main()
{
    double a, c;
    int b;
    cout << "введите число: " << endl;
    cin >> a;
    b = (int)a;
    c = a - b;
    string t = to_string(c);
    int pos = int(t.find("."));
    string otv = t.substr(pos + 1);
    cout << "Целое число: " << b << '\n' << "Дробное число: " << c << " " << "или" << " " << otv << endl;
}