Page 1 of 1

Programming learning updates & discussion

Posted: Sun Oct 06, 2013 10:50 pm
by boh123321
Hello everyone!

I just recently started learning C++ (a programming language) and made this thread for me to post little programs I have made and also for people to
discuss programming of any kind (Java, Gamemaker, etc.)

So far my best program is one that takes a number and multiplies it by another number and gives a result

Here it is:

#include <iostream>
//This is put at the beginning of every program

int multiply(int x , int y)
{
return x * y;
}
//This chunk here creates a new function that
//multiplys x and y and returns the number to the system

int main()
{
using namespace std;
cout << "This program will multiply your two numbers" <<endl;
cout << "Type in a number:" << endl;
int x;
int y;
cin >> x >> y;
cout << "This is " << x << " times " << y << ": " << multiply(x , y) << endl;
}
//This part here takes two numbers that you type in
// multiplies them and gives you the result

Yay!

Re: Programming learning updates & discussion

Posted: Wed Oct 09, 2013 8:24 pm
by VirtLands
boh123321 wrote:main()
{
using namespace std;
cout << "I am the
zombie. Goodbye!" << endl;
return 0
}
Excellent. :wink:

Currently I'm using Blitz3D and Pelles C together.
You can use Pelles C to created DLLs which can be accessed by other languages including Blitz.

What version of C++ do you use? I've tried some C++ before, but am
currently just using plain C, ( which is Pelles C ).

Pelles C:
http://www.christian-heffner.de/index.p ... rt&lang=en
http://www.christian-heffner.de/index.p ... ad&lang=en

Blitz3D:
http://www.blitzbasic.com/Home/_index_.php

On the Blitz Community Forum, I go by the same username as I do here, = VirtLands
.

Posted: Wed Oct 09, 2013 9:08 pm
by tyteen4a03
I never really liked Eclipse because of how much RAM it ate - I like JetBrains products better.

I'm going to make a Tile-based engine similar to Wonderland in Panda3D when I'm getting bored with writing my distributed Minecraft server, so maybe I'll be able to pick up C++ then.

JetBrained

Posted: Wed Oct 09, 2013 9:53 pm
by VirtLands
tyteen4a03 wrote: I never really liked Eclipse because of how much RAM it ate - I like JetBrains products better.
Getting Jetbrained.
Only these 4 programs from JetBrains are apparently FREE :

Pycharm 3.0 Community Edition { Python IDE }
http://www.jetbrains.com/pycharm/download/

IntelliJ IDEA 12 { Java IDE }
http://www.jetbrains.com/idea/download/

Meta Programming System :
http://www.jetbrains.com/mps/

Kotlin ... a statically typed programming language that compiles to JVM byte codes and JavaScript
http://kotlin.jetbrains.org/


Posted: Thu Oct 10, 2013 10:12 am
by md
I've done a bit of coding in my times. I know quite a few languages, but my strength at the moment is C# (and XNA).
I've worked a bit with C++ and Java for a bit of Minecraft Modding.

In terms of programs used, I've worked around with Game Maker, Visual Studio, Dreamweaver and Eclipse.

Posted: Thu Oct 10, 2013 3:52 pm
by Sammy_P
I've been learning some C lately.

Posted: Fri Oct 11, 2013 5:46 am
by boh123321
Sammy_P wrote:I've been learning some C lately.
It took me forever to figure out which programming language I wanted to learn. Seriously, it took 2 weeks! :shock:
Virtlands wrote:What version of C++ do you use? I've tried some C++ before, but am
currently just using plain C, ( which is Pelles C ).
Do you mean C++ 10 or C++ 11? I honestly don't know.

by the way, i use code::blocks for my programming.

My new best program is a mini calculator (the code is kinda long and don't really want to right now)

After learning C++ (probably will take 1-2 years) I am considering learning either Java or C#. what do you peoples think.
I am going to buy C++ primer edition 5, which is probably the best C++ book ever (over 1000 pages!)
toodles

Posted: Fri Oct 11, 2013 7:30 am
by tyteen4a03
I don't ever remember C++10 - however I remember C++03 and C++11.

These are just different versions of C++ which improves the syntax. For a beginner, they should start with C++11 (although we don't really mention the "version" of the language)

Posted: Sun Oct 13, 2013 3:07 am
by md
boh123321 wrote:
Sammy_P wrote:I've been learning some C lately.
It took me forever to figure out which programming language I wanted to learn. Seriously, it took 2 weeks! :shock:
Yeah, it took me quite some time too. I was kind of going back and forth between languages.
In the end, I ended up earning a little bit of them all, with a few languages that I learnt more than others.

Posted: Sun Oct 13, 2013 8:32 am
by tyteen4a03
For a beginner, Python is a very good language to pick up.

Blitz Research Products

Posted: Sun Oct 13, 2013 10:42 pm
by VirtLands
Also, try these:

PureBasic demo
http://www.purebasic.com/download.php

Purebasic has over 300 user supplied add-ons (online, in Zip form), so in many cases you don't have to start from scratch.

( The difference between PureBasic demo vs PureBasic FULL is that the demo has the following limitations:
No Win32 API support
No DLL creation
Code size limitation (about 800 lines)
Nag screen

)

DarkBasic Pro -Free version

http://www.thegamecreators.com/?id=2000 ... &page=free

Pelles C - is FREE .
http://www.smorgasbordet.com/pellesc/

Pelles C is an awesome language collection;
it includes loads of free user supplied libraries as well as lots of add-ons.

Show here is a brief display of my Pelles directories.

10/13/2013 04:05 PM <DIR> .
10/13/2013 04:05 PM <DIR> ..
09/21/2013 02:12 PM <DIR> Bin
03/05/2013 07:28 PM <DIR> downloaded
08/23/2013 01:20 PM <DIR> Include
08/23/2013 01:30 PM <DIR> Lib
08/22/2013 02:38 PM <DIR> _Add-ins
08/22/2013 03:01 PM <DIR> _Common Controls
08/22/2013 03:00 PM <DIR> _Custom Controls
08/22/2013 02:49 PM <DIR> _Games
08/22/2013 03:30 PM <DIR> _GdiPlus Examples
08/22/2013 03:31 PM <DIR> _General Graphics
08/22/2013 03:14 PM <DIR> _General Windows
08/22/2013 03:34 PM <DIR> _Graphics (OpenGL_DirectX)
08/22/2013 03:21 PM <DIR> _Libraries
08/22/2013 03:28 PM <DIR> _OLE & COM
08/22/2013 03:10 PM <DIR> _Utilities
08/22/2013 03:25 PM <DIR> _Wizards
0 File(s) 0 bytes
18 Dir(s) 43,573,547,008 bytes free
-----------------------------------------------------------------------------

http://www.blitzbasic.com/Products/_index_.php

Blitz3D has over 12000 user made programs ready for download.
BlitzMax has over 5000 user made programs lready for download.

Posted: Sat Oct 19, 2013 6:02 am
by boh123321
I just bought "C++ Primer" which is one of the best C++ books ever.

I'm about 100 pages in and pointers make my head hurt :lol:

Posted: Sat Oct 19, 2013 9:34 am
by tyteen4a03
boh123321 wrote:I just bought "C++ Primer" which is one of the best C++ books ever.

I'm about 100 pages in and pointers make my head hurt :lol:
Pointers are just stickers on the boxes (memory addresses): They refer to a specific box.

C++ pointers

Posted: Sat Oct 19, 2013 11:37 pm
by VirtLands
It's a fascinating book/topic .

Since I've spent most of my time on regular C instead of C++,
I still assume that the two languages are very similar.



on page 84, you'll start the pointers subject, ...
on page 324, you'll start pointers to functions, ...

Pointers can be really fun, you can do multiple levels of indirection (dereferences).
-----------------------------------------------------------------------------
Here is some strange idea that I dreamed up: ©

You can create a 2 dimensional array of function pointers, where each function itself takes 2 parameters as input;

The 2 parameter type -combo per each function determines that function's placement within that 2D array.

So,...
you call each function directly by means of a function pointer
residing in that 2D array, where their position in the array is dictated
directly by the parameter types.

Each parameter can itself be a pointer to a (data-type + value) structure, ( = abstract data type).

But, for even more data flexibility, the data can be placed in circular "byte" queues instead of structures. Structures would be an inefficient
container to store data, because we don't know ahead of time
what kind of data-types are needed, nor the size of those data types.

For example: Create 2 circular (memory) queues as follows:

DIM Q_D(10000) ; allocate 10,000 bytes for data values
DIM Q_T(10000) ; allocate 10,000 bytes for data-type descriptions

{ Worst case scenario for Q_T() is that each byte in Q_D() is a CHAR data type, and each CHAR is only 1 byte long. }

An example enumeration of data types, can be like this::
UNSIGNED_CHAR, SIGNED_CHAR, UNSIGNED_SHORT, SIGNED_SHORT, UNSIGNED INT, SIGNED INT,...
etc, and starting with enumeration value "1".

So,...., in abstract pseudo-code .....

Quick_sum( INT *i, SIGNED_CHAR *sc) is called by computing
where in a 2D function pointer array that specific combo is.

The benefits of this weird logic are as follows:

(a) Create a generic collection of functions whose parameters can be multiple data types,
the concept is like "parameter overloading", but not exactly.
Each parameter would actually be a pointer to a (data-type & value)structure.
______________
A minor variation of this logic is to use a 1-D (linear) array of function
pointers instead of a 2D array of function pointers.

Each function's position within the linear array can be calculated quickly
as a BOOLEAN SUM of the 2 parameter types:

For example: Quick_Sum( SIGNED_CHAR_type *sc, UNSIGNED_INT_type *ui)

would look for the enumeration reference of SIGNED_CHAR_type=2, and UNSIGNED_INT_type=16,

add them together,

then call function pointer index 18, .... which would be a
dedicated function created just to add a SIGNED char to an UNSIGNED int.

Note that if the parameter types traded places, the result is the same,
( 2+16 = 16+2 =18 ), they would point to the same
dedicated function in a linear array of function pointers. ;)

There would be many dedicated functions, and each would return
an appropriate { data-type + value } structure.

Since there are approximately 14 "C" data types, then there
are approximately 196 (=14*14) combinations of those data types, taken two at a time,
where each data type has an opportunity to meld with any other data type by means of dedicated functions.

A list of C data types:
https://en.wikipedia.org/wiki/C_data_types

Why do all this?
The reason is basically that Blitz3D has only a limited collection of
'data types' and ways it uses them.
Blitz3D has no "DOUBLES", and it has no LONG LONGs (=64 bit).

My ultimate goal is to allow for the flexibility of any data type to mingle
with any other data type (within reason), and to add data types 64-bits and higher .

To be specific, each function would return a reference to a { data-type + value } structure, allowing dedicated functions to be conveniently nested.

These structures in turn can be (optionally) taken from of a circular queue
of previously allocated memory, instead of creating brand new structure
instances each time.

The benefit of this is that "old variables" get automatically reused
after a reasonable queue cycle. There's no chance of overloading your PC's memory.

The downside is that you have to be alert, because if you don't use your
variables in time, their values may CHANGE. :twisted:

These are Short-Lived variables. ©
_______________________________________

( Note that Blitz3D can't do DOUBLES, so a special DOUBLE function has
to be invented. )

An awkward old style Function for DOUBLES is like this:

Does send the sum of (a+b) into dest. THis formation cannot be nested.
DOUBLE_ADD( DOUBLE *a, DOUBLE *b, DOUBLE *dest ) ;
_______________________________________________

My improved version that I have in mind would work like this (if I ever make it): :D

Returns a reference to a queue memory (byte offset) that represents (a+b):
This formation can be nested.

dest *d = DOUBLE_ADD( DOUBLE *a, DOUBLE *b)

And, here's a nesting example:

dest *e = DOUBLE_ADD( DOUBLE_ADD(*a, *b), DOUBLE_ADD( *c, *d) )

e gets the successful result of (a+b+c+d), using a dedicated DOUBLES function.

©©©

Yup, this is crazy stuff.

Posted: Sun Oct 20, 2013 4:48 am
by boh123321
VirtLands wrote:Since I've spent most of my time on regular C instead of C++, I still assume that the two languages are very similar.
C and C++ are basically the same thing except that C++ has classes and OOP unlike its older parent C