0

When I'm working on showing chart in QML, I found an interested things:

# Run this code

for(int col = 1; col <= 5; col ++){
    qDebug() << col;
    qDebug() << col/2;
    qDebug() << col*0.5;
}


# Output
1
0
0.5

2
1
1

3
1
1.5

4
2
2

5
2
2.5

Though the problem has been solved, I'm still wondering: "Why the output did not do implicit casting to convert the int to float?"

Thanks a lot for your great help!

0 Answers0