Skip to content

Instantly share code, notes, and snippets.

View soltys's full-sized avatar

Paweł Sołtysiak soltys

View GitHub Profile
void silnia(int num){
if(num == 1)
return 1;
else
return num*silnia(num-1);
}
private void FindByRecursion(XElement element, string xmlPath)
{
var q = element.Elements();
if (q.Count() == 0)
return;
foreach (var xElement in q)
{
string newXmlPath = xmlPath + "/" + xElement.Name;
string attribute = "[";
@soltys
soltys / gist:998004
Created May 29, 2011 18:20
WordGenerator
#pragma once
#include <string>
#include <vector>
class WordGenerator
{
public:
virtual std::string generateNext();
std::string getCurrent();
WordGenerator(char* range)
{
@soltys
soltys / gist:998005
Created May 29, 2011 18:20
WordGenerator
#include "WordGenerator.h"
#include <algorithm>
void WordGenerator::createAlphabet(char* range)
{
char start,end;
while(*range != '\0') //Koniec stringu
{
if(*(range+1) == '-'){
alphabet.push_back(*range); //Wpisywanie danych które sa swobodne
int main(void)
{
char *s = "hello world";
*s = 'H';
}
@soltys
soltys / gist:1701032
Created January 29, 2012 22:24
Drawing stars from 5 to 1 separated by new line
+++++[>++>++++++++<<-]>>++>+++++[[>+>+<<-]>>[<<+>>-]<[-<<.>>]<<<.>>-]
@soltys
soltys / gist:1798415
Created February 11, 2012 10:12
IsolatedStorageHelpers
namespace Soltys.Library.WindowsPhone
{
public static class IsolatedStorageHelpers
{
public static void SetValue<T>(this IsolatedStorageSettings storage,string key, T value)
{
if (storage.Contains(key))
{
storage[key] = value;
}
class PlatformsRow
{
public PlatformsRow(bool[] platformSettings)
{
if (platformSettings.Length != ROW_LENGTH)
{
throw new ArgumentException();
}
this.platformSettings = platformSettings;
}
unsigned char a,b; //char'y są 8 bitowe (patrz treść zadania)
unsigned short int wynik = 0; // short int 16 bitowy (patrz treść zadania)
a=12; //Ustawiamy dwie wartości które chcemy przemnożyć
b=8;
//Rozpoczynamy wstawkę assemblerową
_asm
{
mov dx,0 //kolejne sumy a << coś będziemy przechowywać w dx (patrz wzór)
mov bl, b //kopiujemy do bl wartość zmiennejb
mov cl, 0x00 //cl będzie przechowywać wykładnik potęgi 2 (patrz wzór)
#include <stdio.h>
#include <ctype.h>
int is_leap_year(int year);
int day_of_year(int day, int month, int year);
int main() {
int day = 0, month = 0, year = 0;
printf("Podaj date (dd/mm/rrrr): ");