Program to check if tank will overflow , underflow or filled in given time | C ++ program to check if Tank will overflow or not in given time ; function to calculate the volume of tank ; function to print overflow / filled / underflow accordingly ; driver function ; radius of the tank ; height of the tank ; rate of flow of water ; time given ; calculate the required time ; printing the result
#include <bits/stdc++.h> NEW_LINE using namespace std ; float volume ( int radius , int height ) { return ( ( 22 / 7 ) * radius * radius * height ) ; } void check_and_print ( float required_time , float given_time ) { if ( required_time < given_time ) cout << " Overflow " ; else if ( required_time > given_time ) cout << " Underflow " ; else cout << " Filled " ; } int main ( ) { int radius = 5 , height = 10 , rate_of_flow = 10 ; float given_time = 70.0 ; float required_time = volume ( radius , height ) / rate_of_flow ; check_and_print ( required_time , given_time ) ; return 0 ; }