Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A
- {
- int m_a;
- public:
- A( const int x )
- : m_a( x )
- {}
- void display() const
- {
- cout<< "The value is " << m_a << "." << endl;
- }
- };
- int main()
- {
- for( int i = 0; i < 2; ++i ) {
- cout<<"Please enter value " << i + 1 << ": ";
- int x; // <- The crucial fix.
- cin >> x; // <- ... and here.
- A obj( x ); // <- ... and here.
- obj.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement