Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <iomanip>
- #include <vector>
- #include <sstream>
- using namespace std;
- void printRow(vector<int>& row) {
- if (row.empty())
- return;
- for (const auto& e : row) {
- // cout << setfill('.');
- if (e != -1)
- cout << setw(10) << e;
- cout << ' ';
- }
- }
- int main() {
- ifstream input("input.txt");
- int n;
- int m;
- string st1;
- input >> n;
- input >> m;
- getline(input, st1);
- while (n > 0) {
- vector<int> values;
- string in;
- getline(input, in);
- stringstream ss(in);
- string v;
- int m_copy = m;
- while (m_copy > 0) {
- getline(ss, v, ',');
- values.push_back(atoi(v.c_str()));
- m_copy--;
- }
- values.push_back(-1);
- printRow(values);
- if (n > 1)
- cout << endl;
- n--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement