Primary school students fun C ++ programming lesson 49

#include <iostream> 
#include <cmath> // Call the function to find the absolute value of floating point fabs () 
using namespace std; 
int main () 
{ 
  double x, y; 
  long long num; 
  cout << "Please input a pure decimal "<< endl; 
  do 
  { 
    cout <<" x = "; 
    cin >> x; 
  } while (x> = 1 || x <= 0); 
  num = 1; 
  do 
  { 
    num * = 10; 
    y = x * num; 
  } while (fabs (y- (int) y)> 1e-9); 
  cout << (int) y << endl; 
  return 0; 
}

  

Link: https://pan.baidu.com/s/1qDdBkFPakLtCvh8_W2wiog 
extraction code: x3zg

 

 
 

Link: https://pan.baidu.com/s/1qDdBkFPakLtCvh8_W2wiog 
extraction code: x3zg

 

Guess you like

Origin www.cnblogs.com/kixiaoyuan/p/12702296.html