Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <vector>
- #include <iomanip>
- using namespace std;
- vector<string> split(const string& text, char delim) {
- stringstream ss(text);
- string item;
- vector<string> elems;
- while (getline(ss, item, delim)) {
- elems.push_back(item);
- }
- return elems;
- }
- int main() {
- ifstream inp("1.txt");
- int N;
- int M;
- inp >> N;
- inp >> M;
- inp.ignore(1);
- while (N--) {
- string line;
- getline(inp, line);
- for (const auto& value : split(line, ',')) {
- cout << setw(10) << value;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement