From Console to visual?

closed account (367kGNh0)
Here, we have a simple console program for a calculator. My question as a beginner is:

A console program doesn't have visual buttons and visual functions. I wanted to know in advance, is there a drastic difference between making a console program and making a visual program? does coding each button fall into a very different area in C++ programming? Whether it does or not can someone please direct me to a visual C++ coding tutorial. Because I really have no idea how to code buttons and thats the crucial part of the indie game layout.

thank you

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <iomanip>
using namespace std;

int main () 
{
double Num1, Num2;
string symbol;

cout << setprecision(2) << fixed; //automatically makes 2 decimal places
cout << "Please enter your first number:\n";
cin >> Num1;
cout << "Please enter your second number:\n";
cin >> Num2;
cout << "Please enter a symbol\n";
cin >> symbol;

if (symbol == "+") {
cout << "The sum of the two numbers is " << Num1 + Num2<<endl;}

if (symbol == "-") {
cout << "The difference of the two numbers is " << Num1 - Num2<<endl;}

if (symbol == "*"){
cout << "The product of the two numbers is " << Num1 * Num2<<endl;}

if (symbol == "/"){
cout << "The quiotient of the two numbers is " << Num1 / Num2<<endl;}



return 0;
}
Last edited on
What is your question?
Console programs and GUI programs are totally different.
There are various ways to create GUI apps. You could use the Windows API or MFC if you use Windows only. There are frameworks like wxWidgets, Qt or GTK+ and many others.
Be aware they all have a steep learning curve. So first think about it if it is worth spending months learning it.
Easier options for GUI apps are Java or Python.
closed account (367kGNh0)
I see, Thank you Thomas. I guess I must.
closed account (367kGNh0)
will I need GUI knowledge to use Cocos2d-x or Cocos Creator?
I wanted to know in advance, is there a drastic difference between making a console program and making a visual program?
If you program the right way, no. The actual meat of program, if designed correctly, can be made independent of the User Interface of your program.

Some programs operate over both command-line interface and graphical interfaces. Programs that deal with version control like git and perforce both have CLIs and GUIs made for them. CMake for building libraries is another example.

Designing command-line access to parts of your program can help in unit tests to ensure correct functionality.

See related: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
Rascake wrote:
will I need GUI knowledge to use Cocos2d-x or Cocos Creator?


Your assumption that all GUI libraries have the same syntax is wrong. Think of vehicles (because I could not come up with a better example). There are cars, airplanes, boats and there are motorcycles. All four let you move faster from one place to another. But they are completely different to operate.

So what knowledge do you need to use Cocos2d? Knowledge of Cocos2d. Simple.
Topic archived. No new replies allowed.