C++入门经典-例2.17强制类型转换
1:代码如下:
// 2.17.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
void main()
{
float i, j;
int k;
i = 60.25;
j = 20.5;
k = (int)i + (int)j;
cout << k << endl;
}
View Code
运行结果: