Hello all, I'm a new user and for 3 years, I've been doing some coding using a scripting language called Pawn for a game called Team Fortress 2.
From those 3 years, I've been using Pawn to create plugins for servers such as my own but I've just about had it with Pawn and I want to branch out to a REAL programming language.
My few choices were C, C++, Java, Python, and Lua.
I ultimately decided that I want my first language to be C++ :D
the tutorial section taught me pretty much what I already learned from using Pawn scripting but when I got to pointers, I got completely stumped :)
I figured that, in order to help me and others learn (I learn by example), I made an educational program for programming students to quickly learn about C++. The program is modeled after a Vending Machine!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
using namespace std;
struct venditem_t //struct names usually have "_t" as their suffix in terms of conventional C++ programming.
{
int m_iCode;
string szItemName;
float m_flPrice;
};
/*it should be noted that structs can work basically the same way as classes do but structs have their data public by default*/
class CVendingMachine /*name is preceded with C to note that it's a class, classes have their data private by default*/
{
/*most member variables have "m_" or just "m" prefixed to their name to denote it's a member of a class.*/
int m_iVendSpace[20]; //space of rows for items to be vended from.
venditem_t m_iItem[20]; //make an instance of a struct in a class.
bool m_bHasDrinks; //does machine vend drinks too?
};
int main()
{
//do shit here
return 0;
}
|
To get a basic gist of what I'm trying to do, I'm basically remaking the tutorials section but into a single, giant program for beginners and differently-experienced programmers to dissect and see. It'll essentially be a reference guide on what C++ can do.
Considering that many of you posting are 10x alot better than me at the moment, How can I implement all of the capabilities that C++ has into this one program so that I and others can learn?