Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ how do I get this to run // hwk_01_main.cpp #include window.h // Use standard main to have console background: int main() { Window

in c++ how do I get this to run

// hwk_01_main.cpp #include "window.h" // Use standard main to have console background: int main() { Window window( "Demo" ); window.show(); window.run(); char ch; std::cout << "Enter x and press Enter to exit: "; std::cin >> ch;

}

________________________________

// window.cpp #include "window.h" //----------------------------- // Window implementation //----------------------------- Window::Window( char* title_ ) : inp_box ( new Input), out_box ( new Output), btn_set_text ( new Button) { title = title_; //inp_box = new Input; //out_box = new Output; //btn_set_text = new button; inp_box.value( "12345" ); out_box.value( "67890" ); } void Window::click_btn_set_text() { char* text = inp_box.value(); out_box.value( text ); } void Window::show() { std::cout << "Window: " << title << ' '; std::cout << inp_box.value() << ' '; std::cout << out_box.value() << ' '; std::cout << ' '; } void Window::run() { click_btn_set_text(); // user clicks the button show(); // display changes } //----------------------------- // Input implementation //----------------------------- char* Input::value() { return text; } void Input::value( char* text_ ) { text = text_; } //----------------------------- // Input implementation //----------------------------- char* Output::value() { return text; } void Output::value( char* text_ ) { text = text_; } ___________________________________

// window.h // ... #include #include // for unique_ptr // ... class Window { char* title; std::unique_ptr< Input > inp_box; std::unique_ptr< Output > out_box; std::unique_ptr< Button > btn_set_text; public: // constructor Window(char* title_); // operations void click_btn_set_text(); void show(); void run(); }; // class Window _________________________________

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago