Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <fstream>
- #include <sstream>
- using namespace std;
- void wypisz(vector<int>& x){
- for (int i : x)
- cout << i << " ";
- cout << endl;
- }
- void sortuj(vector<int> &a) {
- for (int i = 5; i >= 0; i--)
- for (int j = 1; j <= i; j++ )
- if (a[j-1] > a[j]) {
- int tmp = a[j];
- a[j] = a[j-1];
- a[j-1] = tmp;
- }
- }
- int main() {
- vector<int> a = {7, 5, 1, 2, 3, 6};
- string linia;
- vector<int> v;
- vector<vector<int>> obraz; //TODO pomyslec
- ifstream plik;
- plik.open("../dane.txt");
- if( !plik.good() ){
- cout << "Nie można wczytać pliku" << endl;
- return -1;
- }
- while(!plik.eof()){
- getline(plik, linia);
- stringstream iss (linia);
- int number;
- while ( iss >> number)
- v.push_back(number);
- }
- wypisz(v);
- //TODO: zrobic wektor wektorow int i wczytywac kolejne linie
- return 0;
- }
Add Comment
Please, Sign In to add comment