I have been trying to print decimals by storing the variables into float and double but I am not getting the desired output. what don't I understand about these data types?
Following is my code:
int main(){
    double s = 0;
    float r = 1 / 4;
    cout << r << endl;
    cout << pow((1 - s), 2) << endl;
    cout << (2 + s) << endl;
    cout << (1 / 4) * (pow((1 - s), 2)) * (2 + s) << endl;
    return 0;
}
Output:
0
1
2
0
The first line should be 0.25 and the last should be 0.5.
 
    