// Copyright 2016, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Hannah Bast <bast@cs.uni-freiburg.de>.
// Include some functions from elsewhere: stdio (standard input/output) contains
// printf, stdlib (standard library) contains exit and atoi. More about
// libraries in lecture 2.
#include <stdio.h>
#include <stdlib.h>
#include "./BirthdayParadox.cpp"
// Main function, argc is the number of command line arguments and argv is an
// array of pointers to these arguments; this will be explained in a later
// lecture.
int main(int argc, char** argv) {
// printf("Number of command line arguments: %d\n", argc);
if (argc != 2) {
printf("Usage: ./BirthdayParadoxMain <number of people>\n");
exit(1);
}
int n = atoi(argv[1]);
printf("Number of people: %d\n", n);
double p = probabilitySameBirthday(n);
printf("Probability that at least two have the same birthday: %.1f%%\n",
100 * p);
}