下面的算术运算有什么问题? C++

What's wrong with the following arithmetic operation? C++

我只是想做一个简单的算术运算,但 returns 我得到的是 0 值。这是代码:

 main(){

 long Population_A, Population_B; 

 cin>>Population_A;
 cin>>Population_B;

 float Increase_A, Increase_B;

 Increase_A = (6*Population_A)/100; //Here is the problem because I receive 0.
 Increase_B = (3*Population_B)/100;

 }//main

如果Population_A在-16 .. 16范围内,整数乘除结果为0。

如果您想要浮点除法结果而不是将整数值转换为浮点数,请将 6 更改为 6.0F 并将 3 更改为 3.0F