Help with multiplication problem

Hi I am new to C++ codeing and I was recetly writng a program to multiply two numbers. When both numbers are whole the program works perfectly though when one number in in decimal form the program doesn't work please help.

[code]
#include<iostream>

using namespace std;

int main()
{
int a,b,c; //variables
cout<<"enter the value of Fergies :";
cin>>a;
cout<<"enter the value of Lergies :";
cin>>b;

c=a*b;
cout<<"the value of Ergies is: "<<c;

return 0;
}
Remember int is declaring an integer, which do not include decimals. In order to perform this with decimals, you need to declare a, b, and c as either double or float.
Oh Thanks that fixed my problem :)
closed account (z1CpDjzh)
@Ok Hey Its Z: You can also declare it as a double float.
@OP Use the [code- ]Tag at the beginning of your code and a [/code-] but without the "-" part tag at the end of your code to put it in a box like this....
Topic archived. No new replies allowed.