Question
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started