I'm new to c++ and need help getting numbers from a text file and multiplying them. I'm able to display the text but I don't know how to retrieve the numbers from the text file in order for me to multiply them. ( the input.txt file is just a file that has random names associated with numbers. I want to get the numbers from the text so I can multiply them).Thank you.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream myfile ("input.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << '\n';
}
myfile.close();
}
else
cout << "Unable to open file";
system("pause");
return 0;
}