Skip to content

Commit

Permalink
Adding lab5 initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Sep 19, 2024
1 parent 9205207 commit 965185e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lab5/binom.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "binom.hpp"

int main() {

Binom b(10, 0.5);

for (int i = 0; i < 10; i++) {
std::cout << b.factorial(i) << std::endl;
}

return 0;

}
25 changes: 25 additions & 0 deletions lab5/binom.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef BINOM_HPP
#define BINOM_HPP

#include <iostream> // Needed for cout / printf
#include <cmath> // Needed for pow

class Binom {
private:
int n;
double p;

public:
Binom(int n, double p) : n(n), p(p) {};
int factorial(int n) const;
double choose(int a, int b) const;
double dbinom(int k) const;
void print(int k) const;
};


inline int Binom::factorial(int n) const {
return n;
}

#endif

0 comments on commit 965185e

Please sign in to comment.