Converting command line to GUI
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: Converting command line to GUI

  1. #1
    Join Date
    Feb 2009
    Posts
    5

    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.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,893

    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.

  3. #3
    Join Date
    Feb 2009
    Posts
    5

    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.

  4. #4
    Join Date
    Aug 2007
    Posts
    858

    Re: Converting command line to GUI

    Quote Originally Posted by dizzydog View Post
    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.

  5. #5
    Join Date
    Feb 2009
    Posts
    5

    Re: Converting command line to GUI

    perhaps im wrong,i thought a gui was the user interface ie text boxs, windows, child windows etc

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    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.

  7. #7
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    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?

  8. #8
    Join Date
    Feb 2009
    Posts
    5

    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.

  9. #9
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    Re: Converting command line to GUI

    Quote Originally Posted by dizzydog View Post
    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.

  10. #10
    Join Date
    Feb 2009
    Posts
    5

    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.

  11. #11
    Join Date
    Apr 1999
    Posts
    27,446

    Re: Converting command line to GUI

    Quote Originally Posted by dizzydog View Post
    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.

    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.
    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.
    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

  12. #12
    Join Date
    Aug 2007
    Posts
    858

    Re: Converting command line to GUI

    Quote Originally Posted by dizzydog View Post
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center