I have the following header file:
#include <iostream>
const int x = 15;
const int y = 15;
const double lx = 2 / (x - 1);
const double ly = 2 / (y - 1);
And the following code:
#include "t.h"
int main()
{
std::cout << "x: " << x << std::endl;
std::cout << "y: " << y << std::endl;
std::cout << "lx: " << lx << std::endl;
std::cout << "ly: " << ly << std::endl;
std::cout << "lx / 2: " << lx / 2 << std::endl;
std::cout << "ly / 2: " << ly / 2 << std::endl;
}
Output:
x: 15
y: 15
lx: 0
ly: 0
lx / 2: 0
ly / 2: 0
And for some reason I cant figure out why lx
and ly
output as 0
and obviously when I operate with them its also 0
. What am I doing wrong?
Thanks