home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tybc4 / if1.cpp < prev    next >
C/C++ Source or Header  |  1993-03-19  |  274b  |  15 lines

  1. // Program demonstrates the single-alternative if statement
  2.  
  3. #include <iostream.h>
  4.  
  5. main()
  6. {
  7.   double x;
  8.   cout << "Enter a non-zero number : ";
  9.   cin >> x;
  10.   if (x != 0)
  11.     cout << "The reciprocal of " << x
  12.          << " is " << (1/x) << "\n";
  13.   return 0;
  14. }
  15.