473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How To Add A GUI To A C++ Program

Hi all,

I'm a third year CS student. In all my classes, I have only every made programs that have worked via the command line. I'm starting on a personal project that involves creating a program for sports tournaments such as seeding players, displaying stats, etc.

My major questions are:

1). Can I code my program as a simple command line based program, then integrate the GUI after? Or should I implement my program with the GUI the first time around.

2). I've looked into how GUIs can be implemented and want to try wxWidgets. Is this a good idea?

3). Should I use a different language? I've read that GUIs are hard to implement via C++. I have only learned C++, C, and Python, but am not against learning new languages!

4). Are there any good guides that you can recommend to me?

Any and all help are appreciated! Thank you! :D
Jun 22 '20 #1
2 2375
dev7060
636 Expert 512MB
Stream objects are used to accept or display data to the console. Similarly, objects are used with getter and setter methods to display data from/to the GUI. Internal processing remains the same. It's just how the data is moved to and from the methods accordingly keeping in mind the principles of OOP.
Jun 23 '20 #2
Banfa
9,065 Expert Mod 8TB
More formally you should keep your business logic and user interface separate.

Take a simple example, calculate the area of a triangle given it's side lengths. You can just write a console program that does that, but if later you want a GUI program to do it you would have to re-implement the algorithm.

OK so not much of an issue for this simple a formula but for a more complex problem, especially if you have had to test to make sure you get the right results then you not only have to re-implement but re-test everything.

To avoid that you encapsulate your logic in a reusable code unit, a class or a set of classes (or possibly if it's this simple a function). You can then test your reusable code to ensure correct operation. Then you can put whatever interface you want on-top of that code, console, GUI, web service etc.


GUI's are relatively easy to do in C++ (at least as easy as anything else) but pure C++ can't do it you have to add a platform; there are several platforms available but I would recommend Qt, it's what I use at work, it is as simple (or complex) as anything else, it has cross-platform support (Windows, Linux Mac, various mobile, various embedded), it has provenance (been around 25 years) and it is available free under an opensource license.

However there are others
wxWidgets - never used it, but also never heard anyone say anything nice about it
GTK - also never used it but it is widely used
Microsoft has something proprietary and I assume limited to Windows but don't know what it is (last time I used MS it was MFC but I do know they have moved on from that)
Jun 23 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
1
by: Eric Whittaker | last post by:
hi all, im trying to write my first c++ program. a success, but i can't get the window to stay open after user enters input. it just automatically closes. right now the end of my program looks...
1
by: sylsau | last post by:
Hello, I wrote a JAVA program which uses the JAVA API JDOM 1.0 (of this site www.jdom.org) I put the archive jdom.jar in the directory /usr/share/java/jdom.jar and I added this path in the...
9
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working...
7
by: ibtc209 | last post by:
I just started programming in C, and I need some help with this problem. Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s first card, and...
109
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
2
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.