Program to determine focal length of a spherical mirror | C ++ program to determine the focal length of a of a spherical mirror ; Determines focal length of a spherical concave mirror ; Determines focal length of a spherical convex mirror ; Driver function
#include <iostream> NEW_LINE using namespace std ; float focal_length_concave ( float R ) { return R / 2 ; } float focal_length_convex ( float R ) { return - ( R / 2 ) ; } int main ( ) { float R = 30 ; cout << " Focal ▁ length ▁ of ▁ spherical " << " concave ▁ mirror ▁ is ▁ : ▁ " << focal_length_concave ( R ) << " ▁ units STRNEWLINE " ; cout << " Focal ▁ length ▁ of ▁ spherical " << " convex ▁ mirror ▁ is ▁ : ▁ " << focal_length_convex ( R ) << " ▁ units " ; return 0 ; }