1int main()
2{
3 int a=20 , b= 25 , c= 19;
4 int sum = a + b + c;
5 float ave = (float) sum / 3; //this is called type casting (float) sum
6 cout<<"Average is : "<<ave<<endl;
7 return 0;
8}
1int main()
2{
3 short a = 2000;
4 int b;
5 b = (int)a; // c-like cast notation
6 b = int(a); // functional notation
7}
1#include <iostream>
2using namespace std;
3int main(){
4 int x = 4;
5 int y = 2;
6 cout<<"La divisione dei valori e': "<<(float)y/x<<endl;
7}