Mega Code Archive
Categories
/
C++
/
Console
Cin to read float in C++
#include
using namespace std; int main() { double x, y; cout << "Enter two floating-point values: "; cin >> x ; cin >> y; cout << "The average of the two numbers is: " << (x + y)/2.0 << endl; return 0; }