Program to convert fraction to decimal, C/C++ Programming

Program to convert fraction to decimal:

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;

}

Posted Date: 10/18/2012 7:56:21 AM | Location : United States







Related Discussions:- Program to convert fraction to decimal, Assignment Help, Ask Question on Program to convert fraction to decimal, Get Answer, Expert's Help, Program to convert fraction to decimal Discussions

Write discussion on Program to convert fraction to decimal
Your posts are moderated
Related Questions

write a c++ program to accept 3 numbers and find the largest of 3 numbers

Explain Object-oriented programming Object-oriented programming (OOP) attempts to meet these requirements, providing methods for managing enormous complexity, achieving reuse o

We have used logic symbols in the past, but not really though about the actual real devices. Semiconductor companies have taken the logic symbols are manufactured them into logic f

Compiler Design - Limit In The Method Instructions

Write a program that reads a line of characters from the user and displays that entire line after converting any uppercase characters to lowercase also change any lowercase charact

write a function named "fact"that takes one integer arguments,call them "num" and returns as ..............

Write a program that takes 3 small letters as input and sort them according to their ASCII value.


for object, malloc allocates memory in heap however doesn't invoke object's constructor to initialize the object. new allocates memory & also invokes constructor to initialize the