Skip to content
This repository has been archived by the owner on Jun 22, 2019. It is now read-only.

Commit

Permalink
Convert int to unsigned int for size comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Moridi committed May 19, 2019
1 parent 1922206 commit ed5c243
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Part-1/src/cone.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../header/cone.h"
#include "../header/constant.h"
#include "cone.h"
#include "constant.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion Part-1/src/cuboid.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../header/cuboid.h"
#include "cuboid.h"

using namespace std;

Expand Down
28 changes: 16 additions & 12 deletions Part-1/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
#include <vector>
#include <iostream>

#include "../header/shape.h"
#include "../header/sphere.h"
#include "../header/cone.h"
#include "../header/cuboid.h"
#include "shape.h"
#include "sphere.h"
#include "cone.h"
#include "cuboid.h"

using namespace std;


int main()
{
vector<Shape*> shapes;
shapes.push_back(new Sphere(10, 10, 10, 2));
shapes.push_back(new Cuboid(10, 10, 10, 1, 2, 3));
shapes.push_back(new Cone(10, 10, 10, 2, 5));
shapes.push_back(new Sphere(0, -5, 2, 3));
shapes.push_back(new Cuboid(-15, 11, -50, 1, 10, 7));
shapes.push_back(new Sphere(5, 1, 5, 2));
shapes.push_back(new Cone(5, 7, -1, 4, 3));
shapes.push_back(new Cone(-20, 0, 5, 5, 2));
shapes.push_back(new Cuboid(-5, 5, -5, 2, 6, 3));

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;

for (int i = 0; i < shapes.size(); ++i) {
shapes[i]->move(-5, -10, 0);
shapes[i]->scale(2);
for (unsigned int i = 0; i < shapes.size(); ++i) {
shapes[i]->move(-5, -10, -5);
shapes[i]->scale(3);
shapes[i]->move(5, -10, 5);
}

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;
}
2 changes: 1 addition & 1 deletion Part-1/src/shape.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../header/shape.h"
#include "shape.h"
#include <iostream>

using namespace std;
Expand Down
4 changes: 2 additions & 2 deletions Part-1/src/sphere.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../header/sphere.h"
#include "../header/constant.h"
#include "sphere.h"
#include "constant.h"

using namespace std;

Expand Down
4 changes: 2 additions & 2 deletions Part-1/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ do
make
./$2 2>&1 | diff testcases/$i/$i.txt -
if ! ./$2 2>&1 | diff -rq testcases/$i/$i.txt -; then
echo "${RED}$i - Failed!${NC}"
echo -e "${RED}$i - Failed!${NC}"
else
echo "${GREEN}$i - Passed!${NC}"
echo -e "${GREEN}$i - Passed!${NC}"
counter=$(( counter + 1 ));
fi
done
Expand Down
6 changes: 3 additions & 3 deletions Part-1/testcases/4/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ int main()
shapes.push_back(new Cuboid(-5, 5, -5, 5, 5, 5));
shapes.push_back(new Cone(5, 5, 5, 5, 5));

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;

for (int i = 0; i < shapes.size(); ++i) {
for (unsigned int i = 0; i < shapes.size(); ++i) {
shapes[i]->move(-5, -10, -5);
shapes[i]->scale(4);
}

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;
}
6 changes: 3 additions & 3 deletions Part-1/testcases/5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ int main()
shapes.push_back(new Cone(-20, 0, 5, 5, 2));
shapes.push_back(new Cuboid(-5, 5, -5, 2, 6, 3));

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;

for (int i = 0; i < shapes.size(); ++i) {
for (unsigned int i = 0; i < shapes.size(); ++i) {
shapes[i]->move(-5, -10, -5);
shapes[i]->scale(3);
shapes[i]->move(5, -10, 5);
}

for (int i = 0; i < shapes.size(); ++i)
for (unsigned int i = 0; i < shapes.size(); ++i)
cout << shapes[i] << endl;
}

0 comments on commit ed5c243

Please sign in to comment.