Question: In your implementation of Lab 4, which answer best represents the code used to open donation_record.txt? 1. std::fstream file1(donation_total.txt, std::ios_base::trunc); 2.std::ofstream file1(donation_total.txt); 3.std::fstream file1(donation_total.txt, std::ios_base::app);
In your implementation of Lab 4, which answer best represents the code used to open donation_record.txt?
1. std::fstream file1("donation_total.txt", std::ios_base::trunc);
2.std::ofstream file1("donation_total.txt");
3.std::fstream file1("donation_total.txt", std::ios_base::app);
4.std::ifstream file1("donation_total.txt", std::ios_base::trunc);
2---Which is the correct way to extract a donation amount from a string with the format "[Name] [Amount]"?
Assume that stream is a stringstream object that was initialized as such: std::stringstream stream(str);
1.stream >> amount;
2.stream >> name >> amount;
3.name >> amount >> stream;
4.name << amount << stream;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
