.. (לתיקייה המכילה) | ||
How do I get a C++11 compiler? | |
For a windows machine with MinGW, do the following: 1. If you have a 32-bit windows click here. If you have a 64-bit windows, use this link. Download the latest version of GCC for Windows. 2. Unzip the contents of this file into where your MinGW is. Unless you changed it during the original installation, this should be C:\ |
How do I create get C++11 to work in Eclipse? | |
Eclipse handles most features of C++11, especially those which are required for the exercise. 1. Start by creating a new C++ project in Eclipse. 2. Add the -std=c++11 flag by going into Project | Properties | C/C++ Build. Choose C++ Compiler, Settings and add under miscellaneous "-std=c++11". This is almost identical to setting a C project to C99. 3. In addition, to make Eclipse understand C++11, go to Discovery Options (Also under C/C++ Build). Make sure "C++ Compiler" is chosen and under "Compiler invocation arguments" add "-std=c++11" in the end of this line (with a space before ti of course). In case you're wondering, the last part (3), allows Eclipse to parse all the C++ headers files correctly for C++11. |
How do I create this magical & awesome constructor for Polygon which takes { {1,1}, {0,1}, {0,0} }? | |
To implement this constructor you can simply use the following code:Polygon(std::initializer_list<Point> points) : Polygon() {
|
What does the code above mean? | |
Well, it basically goes like this: - C++11 allows creating a constructor which takes an initializer list. This allows initialization like an array in C. - In addition, C++11 allows an expression like { 0, 1 } to be converted to Point using Point's constructor.- This means we can declare a Polygon constructor which takes a std::initializer_list<Point> . (An initializer list of Points)- To implement this constructor without any code duplication. We first use Polygon() to initialize the polygon using its default constructor (which you will need to write). We then use the fact the std::initializer_list<Point> allows usage of the C++11 "foreach" loop, to iterate over all the points and add them to the polygon using addPoint . (Which you need to implement anyhow)The result is a very useful constructor for writing tests or initializing polygons. |
Problem with mailbox | |
Please note that the mail that was published in the original HW (barakpat@cs) is not working due to technical problems. Please send your questions to : ubarakpatattx.technion.ac.il |
2.1 nextWordStart & nextWordEnd - do I need to implement those functions? | |
No, You are not required to implement nextWordStart & nextWordEnd. You do need your code to pass the compile phase, but not the linking phase, |
Can we use the standard library? | |
You may use the following from std: std::ostream std::endl std::cout std::initializer_list std::string std::shared_ptr Also, you may use math.h functions. |
in question 2.2 i get a compilation error , why? | |
please look at the changes in the updated PDF, there was a const missing. |
How should I handle errors in question 3.1? | |
As mentioned in the exercise, you don't need to use exceptions. In cases which you can return a correct value, return it.(for example, the cases you returned POLYGON_SUCCESS in Ex1 ) You can ignore the cases which you were supposed to handle errors. |
Can I implement list.h with an array | |
No, you should implement a Linked- list. |
How does getArea() work? | |
Return the Area of the polygon if the polygon is legal(Convex..), otherwise 0. |
How should I handle errors in 3.1? | |
You don't, In any case that you can return a valid result, corresponding with ex1, return it! Otherwise ignore. |
Can we use the double equal function from the mtmtest.h? | |
Yes, You may use the logic and the epsilon. |
What should I implement? should I implement all the functionality of Question 1? | |
You should implement only the functionality of the example file |
A typo was fixed in the grid_example.cpp | |
removeAntnna was changed to removeAntenna |
Should we implement the == and != for list? | |
Of course, You should implement everything in the examples |
What == means for Lists | |
When they have the Same value and order for their elements |
Should we implement getArea for PolygonArea? | |
No, You must implement ONLY the functionality in the example file for each part. |
Should I compile with the -static flag? | |
No. |
When I compile without the -static flag I get the following error: | |
The problem is the dynamic linking is being done to a wrong directory (the default G++ folder) and it should be linked to the new one. So use this way to execute your program. LD_LIBRARY_PATH=/staff/015/mtm/gcc-4.7.0/lib64 ./list_test And this line to run valgrind : LD_LIBRARY_PATH=/staff/015/mtm/gcc-4.7.0/lib64 valgrind ./list_test |
What happen to the Iterator after making some action on the list? | |
The behavior of the specific iterator is not defined only after the removal of the iterator element. Otherwise, it remains the same |
Must I use Node in order to implement the list? | |
Yes |
Should I use the exceptions in 3.1? | |
NO! |
Does the getSize function in List returns Int or Unsigned int? | |
INT. |
Should I use the code conventions in the test file? | |
YES! |
Must I use shared pointer? | |
Yes, when storing a pointer to polymorphic type you should always use it. |
Can I add an antenna to the grid which gets a Circle or a UnionArea instead of a PolygonArea? | |
Yes , that the all Idea. Antenna can get any Area type. |
When creating a Circle : | |
Radius and Center. |
In question 2.2, cab we throw an exception from the D'tor? | |
Yes |
are getDeterminant & getTriangleArea static functions? | |
Yes |
Where should I get the Shared_ptr? | |
Use: #include <memory> std::shared_ptr< T > |
Should I create a separate class's for Antenna, CellularNetwork and Grid? | |
Yes, you should! |
Does PolygonArea have the same characteristic as Polygon regarding the polygon stored in it? | |
Yes, is must be convex in order to use it functionality etc... |
Is the Polygon size limited? | |
No, you should support any number of Points. |
Can I use the Code I did in 3.1 in 3.3? | |
Yes, of course you can, that’s the all idea. However, please note that PolygonArea is only using Polygon for his needs. |
What should I do with the following exceptions in part 3? | |
These are exception made for part 1 and you should ignore them in all the HW. You can use your code of part 3.1 in part 3.3 as it is and not add any exception handling. |
Can you explain this line: | |
"Cellcom" - name of network &polygon1 - Area* 1 - id 30 - capacity |
If Iterator == List.end() what should happen when doing iterator++? | |
In this assignment you may ignore that case, However you may add an a exception for your own testing. |
Do I need to make a .cpp file for everything even if it will be 1 function? | |
Yes. |
If I'm trying to create a grid which already exists, should i throw an exception? | |
No, you are allowed to assume it will not happen in the scope of the assignment. |
General question, when a function receive a parameter to be stored in somewhere, should it store a copy of the object or the object itself? | |
Always store a COPY of the object in this assignment! |
Is it possible to add an Antenna with the same ID and Capacity but with different Area to different networks? | |
Because this point was not Explicitly stated in the PDF, you may Ignore this case. Of course, you still need to check the ID and the Capacity. |
What happen if I try to add a Network which already exists in the grid? | |
You should throw NetworkAlreadyExistsException. mtm_ex4.h was updated to include this exception. |
What is the Valid values of ID and Capacity? | |
They should both be >0 |
When deleting a network with an Antenna X, can another Network still have the Antenna X has one of its Antennas? | |
Yes, When Deleting a Network you must remove all its Antennas, but other networks can still have those antennas. |
Is it OK to assume that the T type which is given to list have a default C'tor? | |
You are allowed to make this assumption in this exercise. However, please note that this is not a good assumption. A List should assume the existence of a Copy C'tor but not the default one. |
In the function reportsAntennaByCapacity, what should I do if there is more than one Antenna with the same capacity? | |
The Antennas with the same capacity should be sub ordered by their ID. |
What is the right order in returning exception in Grid? | |
If the conditions of more than 1 exception are matched you should return an exception in the following order: 1 - InvalidInputException 2 - NetworkNotFoundException 3 - NetworkAlreadyExistsException 4 - AntennaNotFoundException 5 - AntennaAlreadyExistsException 6 - InvalidAntennaException |
What type is the radius of Circle? | |
Int |
What happen if I call C'tor of Circle with radius < 0? | |
InvalidInputException |
What exception should I throw when I try to add antenna with id 1 and capacity 100 to "Cellcom" when antenna with ID 1 and capacity 200 already exists? | |
You can throw one of the following exceptions: AntennaAlreadyExistsException InvalidAntennaException |
Should I write unit tests for every class I make? | |
Yes, You should write unit test for every class you make, except function classes. |
How should I submit the files? | |
You should submit your files in a Zip with 6 directories: List, Polygon, Grid, Polygontests, Listtests and Gridtests. You should put your complete solution for each part in the first 3 directories WITHOUT any MAIN function. Your complete solution should work when we add the relevant example file and the file we gave you. Your submission should not contain any file from the files we gave you. Inside the other 3 directories you should put your 3 different parts with your unit tests. Inside those folders you must put all your tests file with their main function. (one main function inside every directory) Note that each directory should stand by itself, that means you will probably have the list.h file inside the following directories: List , Grid , Listtests , Gridtests. |
How should I build the MakeFile and where? | |
How should I submit the files? How many folders? The MakeFile should be in the main zip and not inside any directory. It should be able to build our examples and your tests with the relevant rule. Of course we will need to insert our example files and the other files we supplied into the directories for the build to succeed. If you are having problems with creating one big Makefile you are allowed to build separated Makefile in each directory. So you can choose between 1 makefile to 6 makefile |
How should I print a UnionArea which contain 2 UnionArea? | |
Like this: PolygonArea polygon1 = { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 0 } }; Circle circle1(1, Point(0, 0)); PolygonArea polygon2 = { { 0, 0 }, { 0, 4 }, { 4, 4 }, { 4, 0 } }; Circle circle2(2, Point(0, 0)); UnionArea union1(circle2, polygon2); UnionArea union2(circle2, circle1); UnionArea union3(union1,union2); cout << union3; {{[((0,0),2)],[(0,0),(0,4),(4,4),(4,0)]},{[((0,0),2)],[((0,0),1)]}} |
Can we use the double equal function from the mtmtest.h? | |
Yes, you may use the logic and the epsilon. |