ok so we are learning I/O with files. One input file is Data.txt and it contains this:
Robby Tono
5 15
Tim Con
2 13.5
Bella Quint
10 5
and once the output file is created to another .txt file (e.g Ouput.txt) this is displayed.
Robby Tono $75
Tim Con $27
Bella Quint $50
what particular code was done so this "conversion" can happen? Please help
8
Additional Details
Yes, they are multiplied(pretty obvious), but this is done with files. One file is read (DATA.TXT) and contains the information above. And then another file is -Created- output(OUTPUT.TXT) with the names and multiplication like stated above. My question is what code was used to do this?
std::ifstream input("data.txt");
std::ofstream output("output.txt");
if (input)
{
std::string name;
double a, b;
while (std::getline(input, name) && input >> a >> b)
{
output << name << " $" << a * b << std::endl;
input.ignore();
}
}