Posts by teowey • 103 points
3 posts
-
2
votes2
answers2720
viewsA: How can I measure the execution time of a program in c++?
Are you using linux as OS? For a simple program like this I suggest you use time ./a.out at the terminal, where a.out is the executable of your program. This command prints 3 lines (explained…
-
3
votes1
answer1147
viewsA: counting how many days left to finish the year
You are only counting the days from the next month to which you indicate in the standard input (your loop for(int i = mes; i<12; i++)). Add the remaining days in the chosen month to your code:…
-
2
votes1
answer213
viewsA: Could C-structs have builders?
It is not possible to use constructors in C, so you would have to create an auxiliary function that creates and initializes structs. In C99 there is also a technique called Compound Literal, that…