Untitled

 avatar
unknown
plain_text
a year ago
408 B
1
Indexable
#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;
}
Editor is loading...