home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
OTHERUTI
/
TCPP30-3.ZIP
/
EXAMPLES.ZIP
/
INTRO4.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-18
|
489b
|
22 lines
//INTRO4.CPP--Example from Chapter 3, "An Introduction to C++"
#include <iostream.h>
int main()
{
float num, denom; // numerator and denominator of fraction
float value; // value of fraction as decimal
cout << "Convert a fraction to a decimal\n";
cout << "Numerator: ";
cin >> num;
cout << "Denominator: ";
cin >> denom;
value = num / denom; // convert fraction to decimal
cout << '\n' << num << '/' << denom << '=' << value;
return 0;
}