Converting command line to GUI
Im trying to convert a code supplied by my lecturer to a code i can use in borland c++ compiler 6.
#include <iostream>
int main()
{
Double c ;
std::cout << "Enter Celcius";
std::cin >> c;
Double f = 9 * c / 5 + 32;
std::cout <<"Fahrenheit = " << f;
return 0;
}
I have created the gui with an 1 input box and 1 out put box the theory is to input Celcius in the inputbox and click run then the output box will display the Fahrenheit value.
any help would be most appreciated.
additionally if i've missed anything out or need to supply more details just say.
Re: Converting command line to GUI
Well, that's extremely trivial code, so the tough part will be the GUI code. I don't recommend using a graphical GUI tool your first time out----that's a decent timesaver, but it doesn't give you a very good feel for what's actually going on under the hood.
Re: Converting command line to GUI
totally agree but i have been told to do all my work in borland c++ compiler 6.0 . i've argued it but they wont change the curriculum.
Re: Converting command line to GUI
Quote:
Originally Posted by
dizzydog
totally agree but i have been told to do all my work in borland c++ compiler 6.0 . i've argued it but they wont change the curriculum.
What does that have to do with using GUIs? If they want to make GUIs, they should be teaching you how to do so. Given the simplicity of the example program you showed, I don't think they're expecting a GUI.
Re: Converting command line to GUI
perhaps im wrong,i thought a gui was the user interface ie text boxs, windows, child windows etc
Re: Converting command line to GUI
I suspect that borland c++ compiler 6 also allows you to make console applications. That way you don't need a complete GUI and you should be able to compile that piece of code just like it is.
Only weird thing is Double with capital D. It should be double with lower case d.
Re: Converting command line to GUI
Helly DizzyDog,
That seems really odd.
Two typos in a simple code like this (Double) might give off the impression that perhaps you're new to C++, and yet you're required to make a GUI application...
Are you sure that's what you're required to do?
Re: Converting command line to GUI
most def, i have to create a window that asks you to input the degrees c in one box then click run and it will convert it into degrees f in the output box.
This code was copied by sight from his website where it is in pdf so i made the errors.
Re: Converting command line to GUI
Quote:
Originally Posted by
dizzydog
most def, i have to create a window that asks you to input the degrees c in one box then click run and it will convert it into degrees f in the output box.
This code was copied by sight from his website where it is in pdf so i made the errors.
I see.
Code:
I have created the gui with an 1 input box and 1 out put box
If you could show us the code and tell us where you're having trouble with, then perhaps we could help better.
Re: Converting command line to GUI
sorry, im not making sense, like i say imm new to this.
the code above i need to convert into code for the user interface for example i need to link the inputbox name with the celsius input for example
ansistring c = inputbox->text;
ansistring f = inputbox *9 / 5 + 32;
so take the value of inputbox then perform the equation x 9 / 5 + 32 (behind the scenes) and after clicking run the value of the eqaution will be displayed in the outputbox as a decimal.
Re: Converting command line to GUI
Quote:
Originally Posted by
dizzydog
sorry, im not making sense, like i say imm new to this.
So you're asked to run a marthon before you can walk. That makes a lot of sense. :ehh:
You don't have the basics down of just plain C++ programming, yet you're asked to come up with a GUI. Usually you must know the language that you're going to use first before attempting to use the language to create GUI applications.
Quote:
the code above i need to convert into code for the user interface for example i need to link the inputbox name with the celsius input for example
Sounds like an assignment for someone who knows C++ already, and just needs to learn GUI programming. Given that this is Borland C++, and you're casing is all wrong (the Borland type is AnsiString, not ansistring), you need a lot more work in C++ skills, let alone developing a GUI.
Quote:
so take the value of inputbox then perform the equation x 9 / 5 + 32 (behind the scenes) and after clicking run the value of the eqaution will be displayed in the outputbox as a decimal.
This requires someone who knows the Borland OWL or VCL or Windows API programming. Simply put, what you're asking for is what I stated up front -- attempting to run a marathon without learning to walk.
Regards,
Paul McKenzie
Re: Converting command line to GUI
Quote:
Originally Posted by
dizzydog
most def, i have to create a window that asks you to input the degrees c in one box then click run and it will convert it into degrees f in the output box.
This code was copied by sight from his website where it is in pdf so i made the errors.
If you're 100% positive that your instructor wants you to make a GUI application and not a console application, you need to contact him and ask him what to do. Because he's apparently telling you to do something that you haven't learned.