fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. cout << "正常二方(double→int)" << static_cast<int>(pow(10.0,2)) << endl
  11. << endl
  12. << endl; //正常的二方
  13. cout <<"十的幾次方:(double→int)" << endl;
  14. for (int i=0;i<=9;i++)
  15. {
  16. cout << left << setw(5) << i;
  17. cout << static_cast<int>(pow(10.0,i)) << endl;
  18. }
  19. system("pause");
  20. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
正常二方(double→int)100


十的幾次方:(double→int)
0    1
1    10
2    100
3    1000
4    10000
5    100000
6    1000000
7    10000000
8    100000000
9    1000000000