如何分别读入字符串与数字到数组里 c++

Bookkeeping 2
Compile Record 3.5
Sign Contract 1.5
Review Documents 2
Proofread 1
Updating Data 3

1.分别读入两次去判断每行的字符串还是数字,然后分别去处理。(其实等于没有处理)
2.因为字符串个数不是固定的两个所以没有办法用 file >> string1 >> string2 >> num1

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    vector<string> strs;
    vector<double> nums;
    string line;
    while (getline(cin, line))
    {
        auto pos = line.find_last_of(' ');
        strs.push_back(line.substr(0, pos));
        nums.push_back(atof(line.substr(pos).c_str()));
    }
    for (const auto &s : strs)
        cout << s << '\n';
    for (auto n : nums)
        cout << n << '\n';
    return 0;
}
$ g++ -Wall main.cpp
$ ./a.out
Bookkeeping 2
Compile Record 3.5
Sign Contract 1.5
Review Documents 2
Proofread 1
Updating Data 3
Bookkeeping
Compile Record
Sign Contract
Review Documents
Proofread
Updating Data
2
3.5
1.5
2
1
3