Find the remaining balance after the transaction | C ++ program to find the remaining balance ; Function to find the balance ; Check if the transaction can be successful or not ; Transaction is successful ; Transaction is unsuccessful ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findBalance ( int x , float bal ) { if ( x % 10 == 0 && ( ( float ) x + 1.50 ) <= bal ) { cout << fixed << setprecision ( 2 ) << ( bal - x - 1.50 ) << endl ; } else { cout << fixed << setprecision ( 2 ) << ( bal ) << endl ; } } int main ( ) { int x = 50 ; float bal = 100.50 ; findBalance ( x , bal ) ; return 0 ; }