Skip to content

Instantly share code, notes, and snippets.

@PiotrWegrzyn
PiotrWegrzyn / Zadanie23.cpp
Last active June 6, 2018 11:48
Systemy - Posortowana lista plików w folderze do pliku.
}
}
DIR *currentDirectory = opendir("."); //otwiera aktualna sciezke katalogu
std::vector <std::string> files; //tworzymy vector string
struct dirent * files_count = 0;
@PiotrWegrzyn
PiotrWegrzyn / zadanie1.cpp
Created April 26, 2017 16:24
Systemy Op. - Zadanie nr.1 Odczytanie zawartosci pliku i zapisanie do pliku.
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <iostream>
extern int errno;
int main (int argc, char **argv){
@PiotrWegrzyn
PiotrWegrzyn / listy.cpp
Last active April 27, 2017 09:24
Algorytmy i Struktury Danych - Implementacja listy w C++
#include <iostream>
using namespace std;
struct node {
int val;
node * next = NULL;
};
struct list {
node * head = NULL;
#include <iostream>
using namespace std;
//https://gist.github.com/Brejw15/5aed87ba877a0c8cef8b02efc582e7d4
//https://codeshare.io/algorytmyOperacjeNaListach
struct node{
int val;
node * next;
};
#include <iostream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
//https://gist.github.com/Brejw15/1a1b8cb682577264493098ae90d7e511
//http://eduinf.waw.pl/inf/alg/001_search/0114.php
using namespace std;
@PiotrWegrzyn
PiotrWegrzyn / LaborkiAiSD.cpp
Last active June 6, 2018 11:49
Listy Sortowania Drzewka
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int n = 0;
struct node {
int val;
node * next;
};
/*Filename: MN03_Newton
Author: Peter_Wegrzyn
Date: 20.03.18
Kod jest dostosowany do danych z przykladu ze strony http://galaxy.agh.edu.pl/~mhojny/repozytoria/mn/InterpolacjaN.pdf
Jeżeli chce Ci sie wpisywać swoje dane to należy jedynie odkomentować zakomentowane linie oraz zakomentowac tworzenie tabeli.
*/
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
double newton(int ** &resultsTable, int * tabX, int* tabY, int k , int i) {
if (resultsTable[i][k] == NULL) {
@PiotrWegrzyn
PiotrWegrzyn / GrafikaKomputerowaKrzyweB-Skladane.cs
Last active April 23, 2018 10:19
C#;Grafika komputerowa;Krzywe B-Składane;April2018
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@PiotrWegrzyn
PiotrWegrzyn / NewtonCotesQuadrature.cpp
Created May 1, 2018 02:00
Metody numeryczne 01.05.18
#include <iostream>
using namespace std;
double compositeTrapezoidRule(double * pointsX, double *pointsY, int N){
double h = (pointsX[N - 1] - pointsX[0]) / (N - 1);
double area = 0.0;
area += pointsY[0] + pointsY[N - 1];
for (int i = 1; i < N - 1; i ++){
area += 2 * pointsY[i];