Dzisiejsze laby. Reszta kiedy indziej

This commit is contained in:
2022-11-30 16:50:53 +01:00
parent 3f67343476
commit 48083a47de
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int czytaj(char *nazwa){
ifstream plik(nazwa);
string linia;
while (getline(plik, linia)) {
std::cout << linia << std::endl;
}
plik.close();
return 0;
}
int main (int argc, char *argv[])
{
czytaj(argv[1]);
return 0;
}

View File

@@ -0,0 +1,17 @@
#include <iostream>
#include <fstream>
using namespace std;
int generator(int n, char *nazwa){
ofstream plik(nazwa);
for (int i = 1; i <= n; i++) {
plik << i << endl;
}
plik.close();
return 0;
}
int main (int argc, char *argv[])
{
generator(atoi(argv[1]), argv[2]);
return 0;
}