cpp文件是需要cin>>的,请问在写linux shell脚本的时候该怎么在./*.cpp之后,输入参数?

shell script如下:

  1                                                                 
  2 #!/bin/bash  
  3 for param1 in 2.5 3.0
  4 do
  5     ./main
  6 
  7 done

main.cpp如下:

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    double param1;
    cin>>param1;
    ofstream dd("data.txt",ios::out);
    if(!dd)
    {
        cout<<"fail to open data.txt\n";
        exit (0);
    }
    dd<<param1;

    dd.close();
    return 0;
}

就是说,在shell script的第六行应该跟什么命令,可以把定义的参数给main?

https://blog.csdn.net/weixin_42183514/article/details/83690417