Convert character array to float?

前端 未结 3 836
半阙折子戏
半阙折子戏 2021-01-15 09:21

I\'m writing a very basic command line C++ application that takes arguments on execution.

I just started C++ today, and it seems apparent that you can only take

3条回答
  •  情深已故
    2021-01-15 09:59

    Using this to convert your input to float number,

    double f1, f2;
    if (argc == 2)
    {
        f1 = atof (argv[0]);
        f2 = atof (argv[1]);
    }
    

提交回复
热议问题