Is there a library or header file that gives a command that accepts decimals? I have been trying to get decimal input from the user but when I output it, it only prints the numbers before the decimal. Either a header file or I am doing something wrong.
Here is what I am trying to make (example):
Code:#include <iostream.h>
#include <stdlib.h>
int main()
{
long a;
system("CLS");
cout<<"Please enter a decimal number: ");
cin>>a;
cout<<"\nThe number you entered is "<<a<<endl;
system("PAUSE");
return 0;
}
// Here is what I got:
/*
Please enter a decimal number: 1.23
The number you entered is 1
Press any key to continue...
*/