Skip to content

Instantly share code, notes, and snippets.

View iamandrewluca's full-sized avatar
🚨
Git Inspector

Andrei Luca iamandrewluca

🚨
Git Inspector
View GitHub Profile
// #include ...
int numara(int ** a, int n, int m)
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (a[i][j] >= 0 && a[i][j] <=0)
count++;
@iamandrewluca
iamandrewluca / dots.c
Last active January 3, 2016 03:39
Making in a string from multiple dots one dot
#include <stdio.h>
#include <string.h>
int main(void) {
// your code goes here
char text[] = ".andrei... luca..varu.jora...a......sula.....";
char * ptext = text;
char * punct = ".";
int numarPuncte = 0;
int lungime = 0;
@iamandrewluca
iamandrewluca / square_root.c
Last active January 3, 2016 06:19
Extract number from a square root in 2 numbers
#include <stdio.h>
#include <math.h>
int main()
{
int x = 20;
int v1 = x, v2;
while ((v1 > 1) && ((x / (int)pow(v1,2)) != (x / pow(v1,2)))) v1--;
v2 = x / pow(v1,2);
@iamandrewluca
iamandrewluca / Matrice.cpp
Created February 21, 2014 16:27
Supraincarcarea operatorului [][] in C++ creind o matrice.
/**
Titlu: Supraincarcarea operatorului [][] in C++ creind o matrice.
Autor: Luca Andrei
Ideone: http://ideone.com/y8Km37
Descriere: De fapt operatorul [][] nu poate fi supraincarcat,
deoarece el nu este operator )), ma contrazic pe mine ce am scris in titlu ).
De fapt aici sunt doi operatori []. Pentru a "supraincarca" [][], avem nevoie
sa cream 2 clase, si pentru fiecare in parte sa supraincarcam [].
Urmariti exemplul de mai jos pentru lamurire.
/**/
#include <iostream>
class Punct
{
private:
float x;
float y;
public:
Punct(): x(.0f), y(.0f) { std::cout << "default" << std::endl; }
Punct(float _x, float _y): x(_x), y(_y) { std::cout << "general" << std::endl; }
// in cazul tau e polimorfism pe functii curate ))
// nu sunt sigur daca merge, dar de ce nu
typedef struct {
int a;
char b;
float c;
// ... alte tipuri
} elev;
//=============================================================================
// ----- Inceputul programului
//=============================================================================
/*
Name: Algoritmul de determinare a grafului de acoperire
Copyright: Luca
Author: Luca Andrei
Date: 28/05/12 18:42
Description: Acest program determina graful de acoperire
#include<stdio.h>
#include<conio2.h>
#include<stdlib.h>
#include<dos.h>
typedef struct val {
unsigned v:2;
}val;
void ver_m_i();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace pr2
{
class Program
@iamandrewluca
iamandrewluca / highbbcode.js
Created August 27, 2015 09:01
TMD BBCode Highlighter (userscript)
// ==UserScript==
// @name TMD BB Code Highilighter
// @author tmd(trolic, Spider)
// @description This script will add a feauture to torrentsmd.com post menu. Use old code button, 20th in the row.
// @include http://*.torrentsmd.*/forum.php?action=viewforum*
// @include http://*.torrentsmd.*/forum.php?action=viewtopic*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// ==/UserScript==
function getCaret(node) {