Skip to content

Instantly share code, notes, and snippets.

View calindotgabriel's full-sized avatar
🦁
typing...

Calin Gabriel calindotgabriel

🦁
typing...
  • Endava
  • Cluj-Napoca
View GitHub Profile
@calindotgabriel
calindotgabriel / counter.cpp
Created February 5, 2014 10:49
binary counter
#include <fstream>
#define Nmax 40
int n, mask[40];
int next(int mask[]) {
int i ;
for (i = 0 ; i < n && mask[i]; i ++)
#include <iostream>
using namespace std;
int a[10][10], n;
void show () {
cout << "--------------- \n";
for (int i = 0 ; i < n ; i ++) {
@calindotgabriel
calindotgabriel / kmp.cpp
Last active August 29, 2015 14:02
pattern searching algorithm KMP, just the precomputer part for now.
#include <iostream>
#include <fstream>
#include <string.h>
#define Nmax 101
using namespace std;
ifstream f("date.in");
#include <iostream>
#include <fstream>
#include <limits.h>
using namespace std;
ifstream f("date.in");
int n;
int m[10];
def get_all_borrowed_books(self):
if not self.get_all():
raise RepositoryException("No books saved.")
cl_book_links = self.get_all()
borrowed_books = []
for link in cl_book_links:
link_book = link.get_book()
books_from_records = convert_bookrecord_to_books(borrowed_books)
/*
Progr. C ce primeste ca argumente nume de fisier si pt. fiecare creeaza un thread
ce calculeaza dimensiunea lui. La sfarsit se afiseaza maximul dintre dimensiuni.
*/
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
int max = -1;
#include "product.h"
Product::Product() : id(0), name(""), qty(0.0) { }
Product::Product(int id, std::string name, long qty):
id(id), name(name), qty(qty) { }
int Product::getId() {
return id;
}
#ifndef PRODUCT_H
#define PRODUCT_H
#include <string>
class Product
{
private:
int id;
std::string name;
#include "mainwindow.h"
#include <QApplication>
#include <assert.h>
#include <string>
#include "product.h"
void test() {
Product product = Product(1, std::string("patrunjel"), 7.0);
assert(1 == product.getId());
1 patrunjel
2 noroi
3 pisici