C++/Programming thread

Really? C/C++ is nowhere near as useful as Matlab for most engineers!

Can anyone here briefly explain: Why C++ and what for?

because it’s a programming language and for creating programs

King_Kaddo, I think you require more context, other wise you end up with vague answers such as why C++ exists, could you have meant why the OP chose to use C++? (vague answer to that is “This is the C++/Programming thread.” :stuck_out_tongue: )

If you need to work on high performance applications and/or require low level memory management then C++ is the way to go.

If you want to just make a simple application, a tool, or something for most workplaces then Java, .net, python and so are may be better.

Depending on what you need to do determines the language to use.

Also, the reason most CS students are required to learn C++ first is to understand memory management, pointers, and whats under the hood. Those who learn java first tend to be confused when learning such topics afterwords.

Ok, update, i’ve got the grid working and updating, I’ve yet to implement a high score function, but the thing that is confusing me is how I’m going to detect a winner. Is the best way to do it by checking all cells using a lengthy if statement?

Code so far:

Thanks guys.

I looked at my player move function, all the if statements and nearly died, so i redid it,

:slight_smile:

Next time use pastebin as it formats the code ;D

To see if you have a solution check the last cell and what is around it. Only count the cells which are the same type and stop counting if not or empty. Since we are assuming the middle cell is accurate and only counting the sides then we only need to find 3 other like cells.

For example, count left and right then add the two up. So, If the count >= 3 then the player has won. Now do this for up/down and the diagonals.

You can keep a sorted vector or some other sorted container which holds the winning players name and score. So when you want to display it just loop through the sorted vector.

ohhh! Now i get it it! : D

Thanks!

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.