Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <vector>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <iomanip>
- using namespace std;
- //void print_vector(vector<string> st) {
- //for(cons)
- //}
- int main() {
- ifstream input("C:\\Users\\hrachyh\\Desktop\\f.txt");
- string rows, columns;
- getline(input, rows, ' ');
- int row = stoi(rows);
- //cout << row << endl;
- getline(input, columns);
- int column = stoi(columns);
- //cout << column << endl;
- int alw = column;
- while (row != 0) {
- vector <string> str_vect;
- string stf1;
- while (column != 0) {
- if (column == 1) {
- getline(input, stf1, '\n');
- str_vect.push_back(stf1);
- }
- else {
- getline(input, stf1, ',');
- str_vect.push_back(stf1);
- }
- column -= 1;
- }
- str_vect.push_back("end");
- for (const string& a : str_vect) {
- if (a != "end") {
- cout <<' '<< setw(10) << a;
- }
- }
- if (row != 1) {
- cout << endl;
- }
- row -= 1;
- column = alw;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement