Console to win app
-
Hello ! I am beginner in C++ and i need some help from you ! I want to make my console program into windows application, but I dont now how to do it. Please help me ! Thank you. Boco :confused: //PROGRAM FOR CALCULATING SUM AND AVERAGE OF TWO NUMBERS #include #include int main () { float num_1, num_2; double sum, average; cout << "\n\t\t******************************************* "; cout << "\n\t\t* PROGRAM FOR CALCULATING SUM AND AVERAGE * "; cout << "\n\t\t* OF TWO NUMBERS * "; cout << "\n\t\t* Version 1.0, February, 2004 * "; cout << "\n\t\t******************************************* "; cout << "\n\n\n\n\n Enter first number: "; cin >> num_1; cout << "\n Enter second number: "; cin >> num_2; sum = num_1 + num_2; average = sum / 2.0; cout << "\n\n Calculated sum is: " << sum << endl; cout << "\n Calculated average is: " << average << endl; cout << "\n\n\n\n\n For exit from program press [Enter] >>>>> "; getchar(); return (0); }
-
Hello ! I am beginner in C++ and i need some help from you ! I want to make my console program into windows application, but I dont now how to do it. Please help me ! Thank you. Boco :confused: //PROGRAM FOR CALCULATING SUM AND AVERAGE OF TWO NUMBERS #include #include int main () { float num_1, num_2; double sum, average; cout << "\n\t\t******************************************* "; cout << "\n\t\t* PROGRAM FOR CALCULATING SUM AND AVERAGE * "; cout << "\n\t\t* OF TWO NUMBERS * "; cout << "\n\t\t* Version 1.0, February, 2004 * "; cout << "\n\t\t******************************************* "; cout << "\n\n\n\n\n Enter first number: "; cin >> num_1; cout << "\n Enter second number: "; cin >> num_2; sum = num_1 + num_2; average = sum / 2.0; cout << "\n\n Calculated sum is: " << sum << endl; cout << "\n Calculated average is: " << average << endl; cout << "\n\n\n\n\n For exit from program press [Enter] >>>>> "; getchar(); return (0); }
Reposting won't get you an answer any faster. A Windows application needs to be structured very differently from a console application. You respond to events from the operating system, rather than driving the process yourself. You need, at the very least, to create a window with suitable controls, then start up a message loop. Frameworks such as MFC can provide a lot of the boilerplate code for you. There isn't space to go into it here, and there are many resources. Try for example Programming Windows by Charles Petzold, Programming Windows with MFC by Jeff Prosise, or for a simpler reference, try Teach Yourself MFC in 24 Hours from SAMS. I would recommend an MFC dialog-based application, with two edit boxes for the two numbers, static controls for the results, and a Calculate button. You would then perform your calculations and show the results in a
BN_CLICKED
handler for the button. Alternatively you could simply handleEN_CHANGE
on both the edit fields and compute the results as the user types. It's up to you. -
Reposting won't get you an answer any faster. A Windows application needs to be structured very differently from a console application. You respond to events from the operating system, rather than driving the process yourself. You need, at the very least, to create a window with suitable controls, then start up a message loop. Frameworks such as MFC can provide a lot of the boilerplate code for you. There isn't space to go into it here, and there are many resources. Try for example Programming Windows by Charles Petzold, Programming Windows with MFC by Jeff Prosise, or for a simpler reference, try Teach Yourself MFC in 24 Hours from SAMS. I would recommend an MFC dialog-based application, with two edit boxes for the two numbers, static controls for the results, and a Calculate button. You would then perform your calculations and show the results in a
BN_CLICKED
handler for the button. Alternatively you could simply handleEN_CHANGE
on both the edit fields and compute the results as the user types. It's up to you. -
Mike, that sounds very havy, do you have maybe same example like my program is ? Boco :confused: