type casting in cpp
int main()
{
int a=20 , b= 25 , c= 19;
int sum = a + b + c;
float ave = (float) sum / 3; //this is called type casting (float) sum
cout<<"Average is : "<<ave<<endl;
return 0;
}
type casting in cpp
int main()
{
int a=20 , b= 25 , c= 19;
int sum = a + b + c;
float ave = (float) sum / 3; //this is called type casting (float) sum
cout<<"Average is : "<<ave<<endl;
return 0;
}
casting C++
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
cast c++
#include <iostream>
using namespace std;
int main(){
int x = 4;
int y = 2;
cout<<"La divisione dei valori e': "<<(float)y/x<<endl;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us