How to output array of doubles to hard drive?

前端 未结 6 514
野的像风
野的像风 2020-12-09 06:42

I would like to know how to output an array of doubles to the hard drive.

edit:

for further clarification. I would like to output it to a file on the hard

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 07:18

    #include 
    
    void saveArray(double* array, int length);
    
    int main()
    {
        double array[] = { 15.25, 15.2516, 84.168, 84356};
        saveArray(array, 4);
    
        return 0;
    }
    
    void saveArray(double* array, int length)
    {
        ofstream output("output.txt");
    
        for(int i=0;i

    here is a way to output an array of doubles to text file one per line. hope this helps
    EDIT
    Change top one line to this two, and it will compile in VS. You can use multithreading to not blocking system wile saving data

    #include 
    
    using namespace std;
    

提交回复
热议问题