repl.it
C++

Trying to make a vector class with some of the knowledge gained from class

fork
loading
Files
  • main.cpp
  • Vector.cpp
  • Vector.h
  • Vector2d.cpp
  • Vector2d.h
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include "Vector.h"
#include "Vector2d.h"

int main() {
  std::cout << "Hello World!\n";
  Vector FirstVector(10, 10, 10);
  Vector SecondVector(20, 20, 20);
  FirstVector.AddVector(SecondVector);
  FirstVector.PrintDetails();
  Vector AddedVector = FirstVector.AddVector(SecondVector);
  AddedVector.SetVectorName("Added Vector");
  AddedVector.PrintDetails();

  Vector2d TwoDimensional(3, 3);
  Vector2d TwoDimensionalOther(-3, -3);
  float MagnitudeOfTwo = TwoDimensional.GetMagnitude();
  std::cout << "The magnitude is: " << MagnitudeOfTwo;
  std::cout << std::endl;

  std::cout << "The dot product of the two is: " << TwoDimensional.DotProduct(TwoDimensionalOther) << std::endl;

  Vector2d NormalizedVector = TwoDimensional.Normalize();
  NormalizedVector.GetDetails();
  std::cout << "Normalized this is: " << NormalizedVector.GetMagnitude();


}
Fetching token
?