.Write a c++ program that creates a decimal pointer, creates a variable set to a decimal value, then assigns the address of the variable to the pointer. User the pointer to print out the address and the value being pointed to by the pointer.
My code is :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
usingnamespace std;
int main()
{
int count = 5.1;
int *pCount = &count;
cout << "The Value of the count is " << count << endl;
cout << "The address of count is " << &count << endl;
cout << "The address of pCount is " << &pCount << endl;
system("Pause");
return 0;
}
How do i declare a decimal, i used int, but it prints out 5 instead of 5.1