int a;
float x;
a = 7;
x = a; // coercion
x = float(a); // conversion c++ style
x = (float) a; // conversion c style
int x;
x = 2.999999;
cout << x <<
Will produce
2
(Plus a warning about assignment from double to int)
int totalPrograms = 4,
studentCount = 6;
float averagePrograms;
averagePrograms = totalPrograms/studentCount;
averagePrograms = float(totalPrograms)/float(studentCount);