Skip to content

qduong42/42_cpp_Module07

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cpp Module 07 - @42Wolfsburg

About

CPP Module 07 introduced me to Templates in CPP.

Installation & Usage

Requirements

The only requirements are:

  • GNU make (v3.81)
  • c++ (clang++) v.12.0.0
  • compile with -std=c++98 flag.

Those versions are the ones used during development.

Building the program

  1. Download/Clone this repo

     git clone https://github.com/qduong42/42_cpp_Module07
    
  2. cd into the exercise directories and run make for (int i = 00; i <= 02; i++) { cd 42_cpp_Module07/exi make }

Running the program

After running make, you can run the program following the instructions printed in the terminal by the Makefile.

Main Project Instructions

  • Piscine style C++ Excercises to introduce us to C++ Beginner Concepts.

Mandatory

  • Only code in a C++ way. C functions should be avoided as much as possible.
  • NO CODING NORMS!
  • No memory leaks
  • Must have a Makefile to build the program
  • Files to turn in partially given.

CPP Module 07 Templates

  • Special functions operate generic types: Function template => Functionality adapted to more than 1 type or class.

Template parameters.

  • special kind param pass type as arg.

Syntax:

  • template function_declaration;
  • template function_declaration;

class/typename difference indistinct.

template myType max(myType a, myType b) { return (a>b?a:b); // if a > b, return a, otherwise b }

  • Calling templates: max (param);
  • type replaces all myType

Enjoy!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published