Skip to content

Instantly share code, notes, and snippets.

View talbenari1's full-sized avatar

Tal Ben-Ari talbenari1

  • Mountain View, CA
  • 20:36 (UTC -07:00)
View GitHub Profile
@talbenari1
talbenari1 / makefile
Created December 1, 2015 00:49
My COMSC-210@DVC makefile.
# The compiler to use. g++ should work as well.
CC = clang++
# CC = g++
# The flags to set during compilation.
CFLAGS = -g -O2 -Wall -MMD -MP --std=c++11 -fdiagnostics-color=always
# My prefix
NAME := BenAriTal
@talbenari1
talbenari1 / programs.md
Created April 12, 2015 17:34
C++ Programs

Programs

For all of these programs, never use using namespace std;. Declare each function explicitly as necessary.

  1. Write a function named insertionSort that takes a pointer to an integer and an integer as arguments. The function should sort the array passed to it using the insertion sort algorithm and print out each step of the process. Demonstrate the function in a program. Do the same for selection sort, or any other sorting algorithm that interests you.

  2. Write a function template named sum that takes two different types as arguments. The function returns the sum of the two values passed to it, using the type given by the first value. Demonstrate the template in a program with combinations of int and double.

  3. Write two functions that each take a pointer to an integer, an integer, and a string as arguments. One function, arrayToFile, should push the contents of the given array to the given filename. The other function, fileToArray, pushes the contents of the file to the array. Demo

Keybase proof

I hereby claim:

  • I am talbenari1 on github.
  • I am talbenari1 (https://keybase.io/talbenari1) on keybase.
  • I have a public key whose fingerprint is C82F 3773 E0CF BFD3 5B6F 799D 5F4F CF8C 5AD0 4FAB

To claim this, I am signing this object: