C/C++ TIC-TAC-TOE GAME

This is the main code of my C/C++ TIC-TAC-TOE GAME using the boolean algorithm without calculating all the probability. Using the rand() function to maintain the IA and forcing to play some cases with a chance of 99% , the other 1% is to make the game dynamic (realistic). Custom Cursor Algorithm by using simple …

C/C++ TIC-TAC-TOE GAME Read More »

C++ Templates: Program to Swap Two Numbers Using Function Template

What are Templates in C++? Templates help in defining generic classes and functions and hence allow generic programming. Generic programming is an approach where generic data types are used as parameters and the same piece of code work for various data types. Function templates are used to create family of functions with different argument types. …

C++ Templates: Program to Swap Two Numbers Using Function Template Read More »

C++ Program That Defines a Class String and Overload == Operator to Compare Two Strings [Operator Overloading Concept]

#include<iostream> #include<stdio.h>                             //used for gets() #include<string.h>                           //used for strcmp() using namespace std; class String {         char str[20];         public:         void getdata()                            //function to read the string         {                 gets(str);         }         //operator function to overload comparison operator and compare two strings         int operator ==(String s)         …

C++ Program That Defines a Class String and Overload == Operator to Compare Two Strings [Operator Overloading Concept] Read More »