Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*int main()
- {
- setlocale(LC_ALL,"");
- string num,integer_temp,fraction_temp;
- int value,integer;
- double fraction,result;
- system("cls");
- cout << "Введите число, дробная часть указывается через \" . \"\n\n";
- cin >> num;
- value = num.find('.');
- integer_temp = num.substr(0, value);
- fraction_temp = num.substr(value+1, num.size());
- fraction_temp.insert(0,"0");
- integer = stoi(integer_temp);
- fraction = stod(fraction_temp)/powerup(10,fraction_temp.size()-1);
- int int_res = 0,temp = 1; // temp - разряды
- while (integer)
- {
- int_res += integer % 8 * temp;
- integer /= 8;
- temp *= 10;
- }*/
- double frac_res = 0, temp1; // frac_res результат перевода, temp1 - переменная для разрядов
- for (int i = 0; i < 8; i++)
- {
- fraction *= 8;
- double temp1 = (int)fraction;
- frac_res += temp1 * powerdown(10,i+1);
- fraction -= temp1;
- }
- /*result = int_res + frac_res;
- cout << setprecision(8+value) << result ;
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement