Skip to content

Instantly share code, notes, and snippets.

View tudorconstantin's full-sized avatar
🏠
Working from home

Tudor Constantin tudorconstantin

🏠
Working from home
View GitHub Profile
0xc2D7d1a127D0448d826d86D1b304e9a3178837cC
--- Modern Application Design
--- Why it's worth the extra effort to understand Catalyst over simpler frameworks like Mojolicious or Dancer
#!/usr/bin/perl
#Write a program, codepoints2char.pl, that can take a list of decimal (not hexadecimal) numbers
#and print the Unicode character. Assume UTF-8. Try running it with the following:
#perl codepoint2char.pl 3232 95 3232.
use strict;
use warnings;
use diagnostics;
@tudorconstantin
tudorconstantin / loto.pl
Last active August 29, 2015 14:25
loto
use strict;
use warnings;
use Data::Dumper;
my $numbers = [];
#repetam PANA CAND (de unde si while) avem 6 elemente in $numbers
while (scalar @$numbers < 6){
@tudorconstantin
tudorconstantin / exchange_integers_with_pointers.c
Created June 15, 2015 03:40
exchange 2 integers using pointers in c
// Using pointers to exchange values
#include <stdio.h>
void exchange_values( int * const pint1, int * const pint2)
{
int temp;
temp = *pint1;
*pint1 = *pint2;
@tudorconstantin
tudorconstantin / substr.c
Created June 6, 2015 13:21
substr function implementation
/* Make a function substring() to extract a
portion of a charcter string.
subtring("character", 4, 3, result)
extract 3 charters begining from charter 4, and put the
result in array result*/
#include <stdio.h>
#include <string.h>
const char* substring( char string[], int start_at, int length, char result[] )
@tudorconstantin
tudorconstantin / word_counting.c
Created June 1, 2015 09:59
Word counting in c
/* The countWords() function from program 9.7 and 9.8
incorectly counts a word that contains an aphostrophy
as two words. Modify this funcion to corectly handel
this situation. Also, extend the founction to count a
sequnce of positive or negative numbers, including
embeded comma as a single word */
// Function to determine if a chracter is alphabetic
#include <stdio.h>
@tudorconstantin
tudorconstantin / clocks.c
Created May 27, 2015 17:41
date and time incrementations in C
/* Write a function called clocKeeper() that
takes as it argument date_and_time structure as
defined in this chapter.The function shuld call
the timeUpdate() and if it reaches midnight, the
function shuld call the dateUpdate() to switch over
to the next day.Have the function to return the updated
date_and_time structure*/
#include <stdio.h>
#include <stdbool.h>
@tudorconstantin
tudorconstantin / gist:74c2bd8bb687c1405238
Created April 22, 2015 08:37
average_of_ten_numbers_with_validation.c
/* Write that calculates an avereage of an
array of an array of 10 floating points values*/
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
float array[10], array_elements_sum = 0, array_elements_avreage = 0, array_elements_temp ;
int i;
@tudorconstantin
tudorconstantin / calculator.c
Created April 4, 2015 09:51
a cleaner solution to the problem of creating a calculator from CS50
/* Write a program that acts as a simple calculator.The program shuld
alow the user to input data in form number operator number.
The following operators shuld pe recognized: +, -, *, /, S, E, .
The S operator tells the program to set the acumulator to the typed in
number. The E operator tells the program that execution is to end.
The artmethic operatioons are performed on the contenst of the acumulator with the number
that was keyed in accting as a smaple operand
program output
10S set Acumulator to 10