c1->cd(); hi1->Draw();You will also need c1->Modified(); c1->Update();(The Draw is only a registration of intention to be display on the canvas, the actual Display/Paint is doing by Update.
[quote=“FJ”]. . . However, when the execution reaches the cout/cin lines, the canvas 1 is drawn empty in spite of having given the draw command earlier with c1->cd(); hi1->Draw();So I cannot see the histogram 1 to enter meaningful factor for further work. . . . [/quote] It is a correct behavior. You can not see anything unless your application enters the ROOT event loop.
The best way to solve your issue is to start the normal ROOT and create 3 C++ functions. Please, download the dialog.C attached and try:
root.exe dialog.C+
root[0] Fill(getfactor())
Please try that. It does what you want EXACTLY. dialog.C (2.51 KB)