PracticeDev/study_cpp/cpp_primer_source_code/Chapter 3/assign.cpp

16 lines
477 B
C++
Raw Normal View History

2022-12-20 17:31:11 +08:00
// assign.cpp -- type changes on assignment
#include <iostream>
int main()
{
using namespace std;
cout.setf(ios_base::fixed, ios_base::floatfield);
float tree = 3; // int converted to float
int guess = 3.9832; // float converted to int
int debt = 7.2E12; // result not defined in C++
cout << "tree = " << tree << endl;
cout << "guess = " << guess << endl;
cout << "debt = " << debt << endl;
// cin.get();
return 0;
}