I'm new to C++ (not programming in general, just C++) and I'm learning to program in C++ with a subscription to Pluralsight. I'm writing a practice program (a set of games through the computer's console) and I'm stuck on something. While working on a Tic-Tac-Toe game, I want to call a formula for the board that I won't have to rewrite every time. Therefore I defined a set of strings to work for me, but I cannot figure out how to call my user defined formula. I'm not going to post all of the code, because it is very long, but I will show your the parts you need (if a line has "...." on it, that means I removed multiple lines of code to make it fit better for this site). Incase you're wondering, I'm using Microsoft Visual Studio Community 2017 RC and C++14.
HEADER FILE:
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <string>
using namespace std;
MAIN FILE:
....
#define TTTBoard () \
{ \
system("cls"); \
cout << "\n\n Let's play Tic-Tac-Toe!\n\n\n"; \
cout << " A B C " << endl; \
cout << " _______________________ " << endl; \
cout << " | | | |" << endl; \
cout << " 1 | " << PlayerSymA1 << " | " << PlayerSymB1 << " | " << PlayerSymC1 << " |" << endl; \
cout << " |_______|_______|_______|" << endl; \
cout << " | | | |" << endl; \
cout << " 2 | " << PlayerSymA2 << " | " << PlayerSymB2 << " | " << PlayerSymC2 << " |" << endl; \
cout << " |_______|_______|_______|" << endl; \
cout << " | | | |" << endl; \
cout << " 3 | " << PlayerSymA3 << " | " << PlayerSymB3 << " | " << PlayerSymC3 << " |" << endl; \
cout << " |_______|_______|_______|" << endl; \
}
....
int main()
{
//This is where I want to call my TTTBoard formula
}
I tried to call it multiple ways, but nothing worked. Below is what I already tried. I know some of what I tried didn't make complete sense, but I was annoyed that I couldn't get it to work, so I tried it all anyway.
TTTBoard
TTTBoard;
TTTBoard()
TTTBoard();
TTTBoard()
{
}
TTTBoard();
{
}
Thank you in advance for the help!!!