cpp_exercises's Introduction
cpp_exercises's People
cpp_exercises's Issues
Ex07 - q1: Problems
@jumang4423 Please add try
/ catch
blocks in the main
function. (We have a guarantee that in the event of an uncaught exception, std::terminate
is being called - thus the error messages that you got).
Ex12: Problems
@jumang4423
Your implementation does not use the specified comparison function
Ex11: Looks good
Ex02 - q2: Minor issues
@jumang4423 Minor issues for ex02-q2
- You can use io-manipulators instead of
cpp_exercises/ex2/Question 2/streams.cpp
Lines 9 to 13 in d371284
The rest looks good.
Please avoid tracking/pushing auxiliary files
@jumang4423 I would like to suggest to modify your .gitignore file such that you do not track auxiliary files. For example, .DS_Store, .vscode, ...
Ex03 - q1
@jumang4423 A few minor things for ex03 - q1 (it looks almost perfect):
should be
float
instead of double
.
After
cpp_exercises/ex3/Question 1/test_pointers.cpp
Lines 65 to 68 in d371284
you should have
delete[] dd;
to match the new
here:
Ex03 - q2: Missing guards in header
@jumang4423 please use guards in the header files (in this case "inc.h") to prevent multiple inclusions.
Ex13: Problems
@jumang4423
Q1 looks good.
For q2, use nth_element
to compute the median (instead of sorting).
Ex05: Avoid the use of pre-compiled headers
@jumang4423 I would recommend to avoid using pre-compiled headers for now (unless you are really sure about what it does).
Ex06 - q1: Problems
Shape2D
(ex06) is an interface. Its member functions should be pure virtual. This is not the case in your implementation.- The pure virtual functions
create
andclone
are missing inShape2D
- No need of the file Shape2D.cpp (there is no implementation for an interface)
- The tests are limited. Interfaces are manipulating via pointers (or references). Without pointers to the base class (the interface), there is no point in having virtual functions.
Ex10: Problems
@jumang4423
Q1:
is_numeric
instead ofis_numberic
?- if the token is a "(", there is no need to push it, just ignore it
Q2:
- header file without guards to prevent for multiple inclusions
- it is not a good idea to have functions defined in a header file unless if they are inline
It is OK to include bits/stdc++.h in competitive programming, but otherwise, it is better to include only what is really necessary.
Ex01 - q2
@jumang4423 for ex01-q2, the (second) formula defining the pmf is recursive. Thus the function binomialPMF
can be defined as a recursive function. Can you please try? (the implementation is 3 lines, including the base cases)
Ex08 and 09
- It would have been cleaner to separate ex08 and ex09, even if it is clear that
MatNxN
is a generalization ofMat4x4
- In the template class, instead of
N
, 4 is used in several instances - The compound operators (
operator+=
,operator-=
,operator*=
) should return by reference (otherwise they can't be chained) - The unary "-" operator should not modify its argument
- The const version of
operator()(int, int)
seems to be missing
Ex07 - q2: Problems
In ex07 - q2 (exception), the only changes should be:
- in
example
where you replaceFILE*
withLogFile
main
where you add atry
/catch
block
There is no need to rewrite, for example, doSomeComputation
.
Similarly, the LogFile
object should be a local object in the function example
. We are experimenting with releasing resources while manipulating exceptions.
Ex04: Possible improvements
@jumang4423 The const-correctness for ex04 looks good.
It is possible to improve the inc_
functions by considering the number of days per month, and the number of months per year.
Ex06 - q2: Incorrect
In ex06 - q2, the class Polygon
should implement the interface Shape2D
. (it should inherit from Shape2D
and implements its pure virtual functions).
Ex01 - q1
@jumang4423 ex01-q1 looks good.
Only a few minor things:
- we need to allocate num_digit+2 for a negative number but only num_digit+1 otherwise
- when you add a minus for a negative number, shouldn't it be
putMinus(str, getDigit(num)+1);
? I.e. you want the terminal '\0' to be moved as well (I think that with the current implementation it gets overwritten). Could you please check?
The code is very well written (and documented).
Ex05 - q2, q3: Problems
@jumang4423 In ex05:
- The assignment operator is leaking memory (you need to
delete[]
before writing_items = new double[]
) - The move assignment operator is missing.
Ex02 - q1: Minor issues
@jumang4423 For ex02-q1, these are some minor issues:
- Shouldn't
Stack::size
return_top+1
?
The rest looks very good.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.