PracticeDev/study_cpp/cpp_primer_source_code/Chapter 5/express.cpp

23 lines
669 B
C++
Raw Normal View History

2022-12-20 17:31:11 +08:00
// express.cpp -- values of expressions
#include <iostream>
int main()
{
using namespace std;
int x;
cout << "The expression x = 100 has the value ";
cout << (x = 100) << endl;
cout << "Now x = " << x << endl;
cout << "The expression x < 3 has the value ";
cout << (x < 3) << endl;
cout << "The expression x > 3 has the value ";
cout << (x > 3) << endl;
cout.setf(ios_base::boolalpha); //a newer C++ feature
cout << "The expression x < 3 has the value ";
cout << (x < 3) << endl;
cout << "The expression x > 3 has the value ";
cout << (x > 3) << endl;
/// cin.get();
return 0;
}