C++ :: Tic Tac Toe - Board Is Not Showing Numbers

Feb 7, 2014

I'm programming tic tac toe but the board is not showing numbers, and it is simply stating the winner without any input: (the win conditions are not complete, but it shouldn't matter).

#include <iostream>
#include<string>
using namespace std;
//Write a two-player tic-tac-toe game; use enums when possible to represent the values of the board

char ticBoard[3][3];
char board[10];
void showBoard();
bool moveIsValid(int m);
int whoWon(); // 0 tied, 1 p1, 2 p.2

[Code] ....

View 6 Replies


ADVERTISEMENT

C :: Generate Set Of Random Numbers On Board (2D Array) Like Candy Crush

Oct 15, 2013

Assignment on making a program like candy crush but it is called as number crush.

View 3 Replies View Related

C++ :: Board Not Printing Correctly

Jul 19, 2013

I'm writing a version of the classic Snake game. However, my board is not printing correctly. The right hand border is in the incorrect location. Also, when I randomly generate where the food ('X') is located, it only generates on the edges of the boundaries.

#include <iostream>
#include <cstdlib>
using namespace std;
const int ROWS = 21;
constint COLS = 61;

[code].....

View 5 Replies View Related

C++ :: How To Make Bool And Void In Board

Mar 14, 2013

void(..)
bool(..)

Direct to the board[8][8].

View 7 Replies View Related

C++ :: Using Loops For Drawing A Checkers Board?

Jan 27, 2014

This is the text of exercise 4 of chapter 12 of PPP; Draw a checkers board: 8-by-8 alternating white and red squares.

Is there a way to use the loop for doing that code to minimize the size of the code?

View 9 Replies View Related

C/C++ :: TicTacToe Board Won't Update - Prints Twice

Feb 22, 2015

Im trying to make a Tic Tac Toe board for an assignment. Right now it compiles fine but when I enter an x or o it does not update the board it just prints out the '.'s that the board is initialized to. Also, when I get to player 2 the board will printout twice so its 6 rows or 3 columns. The project uses a main to ask who starts then goes to a play function that asks for inputs and calls the makeMove function to place the x's and o's and the print function to display the updated board.

bool Board::makeMove(int rowIn, int columnIn, char currentPlayer) {
if (playBoard[rowIn][columnIn] == '.') {
playBoard[rowIn][columnIn] = currentPlayer;
return true;

[Code] ....

View 14 Replies View Related

C++ :: Can't Refresh Checkers Board On Application

Dec 6, 2013

I Cant get my checkers game board to refresh every time i make a move. i have system("cls") But it does nothing of the sort.. To move a pice ive created an illusion which swaps one pieces appearance with another :

void getpiecetomove(int startx,int starty, int endx, int endy) {
boardpiece tmp;
//Regular Moves Pieces
tmp = board[startx][starty];
board[startx][starty] = board[startx+1][starty+1];
board[startx+1][starty+1] = tmp;
system("cls");
}

View 7 Replies View Related

C :: Reading Button Input On Arduino Board

Mar 7, 2013

Okay so this is part of a small uni module around the arduino board. The task is to simulate traffic lights at a junction. At the moment my code below runs through the sequence with 2 seperate lights. When one set of lights turns RED , the other turns GREEN.In my main loop method I need to add a button for a crossing. I want to be able to check if the button is pressed at each of the delays but do not want to have to hold it down.I have thought about putting it at the top of the loop but then the program will only check if button is pressed in that point therefore the user will have to hold it down?

Code:

int green1 = 13 ;
int amber1 = 12 ;
int red1 = 11 ;

int green2 = 6 ;
int amber2 = 7 ;
int red2 = 8 ;
}

[code]....

View 5 Replies View Related

C++ :: Resetting Board On TicTacToe In Order To Play Again

May 25, 2014

How to reset the board in order to play again without spots already taken.

#include <iostream>
#include<cstdlib>
#include<ctime>
using namespace std;

char location[10] = {'0','1','2','3','4','5','6','7','8','9'};
int displayMenu(int &player, int &win);

[Code] .....

View 1 Replies View Related

C/C++ :: Tic Tac Toe - Initialize Arrays At Zero And Output Board To Screen

Sep 13, 2014

/* This is what I have so far what i am trying to do is to initialize the arrays at zero and output the board to the screen. Part of the problem is the user has the option of the board size. All this is suppose to do is to output the board to the screen. I am having problems understanding 2D Arrays.
*/

using namespace std;
int main() {
const int BOARD_MAX = 10; // Maxinum Board size.
const int BOARD_MIN = 3; // Minimum Board size.
array = [COL];
array [ROW];

[Code] ....

View 5 Replies View Related

C :: Dragon Board Serial Monitor Programming Menu

Apr 2, 2014

I am working on my senior project and my currect task is to make a menu. I dont know what the best way to do it. my code is not complete and i am completely lost. code found below:

Code:

#include <hidef.h> /* common defines and macros */#include "derivative.h" /* derivative-specific definitions */
#include "lcd.h"
#include<menu.h>
void main(void) {
char *msg1 = "Menu";

[code].....

View 4 Replies View Related

C Sharp :: How To Use Timer To Move Text Objects Around A Board Onto Textboxes

Apr 2, 2013

Every time the timer clicks it should show a text letter like (T) for tortoise and (H) for hare that moves around the board when the user hits go on the GUI.

View 12 Replies View Related

C :: How To Edit Printed Array Board For Simple Candy Crush Game

Oct 24, 2013

I am required to create a simple candy crush game.

I am this stage where I am required to print the 'box' for navigation purpose at the center of the board once the program initializes.

Here is the code:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//FUNCTION: Draw the Board

[Code].....

I understand that the sequence could be to clear the screen and print the whole board with the indicated marker.

*Yes I am required to move the box in later part of the program but for now, I just need to get the box to show up at coordinate

Code: board[5][5]

I am stuck ...

View 11 Replies View Related

C :: Standard USB Protocol To Follow To Send Data To Embedded Board (and Vice Versa)

Mar 13, 2013

Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa). I have no clue on USB programming using c,is there any example code i could follow,

View 4 Replies View Related

Visual C++ :: Puzzle Game - Implement A Way To Save Board State Throughout User Inputted Path

Mar 16, 2013

I've been trying to figure out how to implement a way to save this board state throughout a user's inputted path. At the end, I need the output to print out the board states (user's path) of how he or she got the puzzle solved. This puzzle is the 15 Puzzle; but we have it to change by the user's input on what size they want to play (3x3 to 5x5). How to save the board state of each user input, then print those out in order from beginning to solved puzzle state. Subsequently, I would also need transferring the board state to change with using a vector to store the size based on user input. How to proceed, using a first search to solve the puzzle from the current board's state.

calculations.h

Code:
/*Calculations set as a header to keep compiling simple and faster*/

#ifndef calculations
#define calculations
int solved[5][5];
void initialize(int board[][5], int);
void slide(int board[][5],int move,int);
bool isBoardSolved(int board[][5],int);

[Code] .....

View 6 Replies View Related

C++ :: SDL Font Not Showing

Jan 19, 2013

SLD_ttf lib and I have been following the Lazy Foo' tuts on it but the text is not appearing. I have found out that it is not loading the font as I have added in the code saying if it has failed.

Code:

font = TTF_OpenFont( "lazy.ttf", 28 );
if( font == NULL )
{
return false;
}

i have saved this font in the project (project name/project name/lazy.ttf).

View 19 Replies View Related

C++ :: Image Not Showing On Top

Jul 1, 2013

I am trying to display images on top of my Background image gui, so like buttons an stuff but the problem is that there not showing ontop. I can only get one of them to show

// includes
#include <windows.h>
#include <stdio.h>
#include "res.h"

// defines
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002

[Code] ....

View 1 Replies View Related

C++ :: Output Is Showing Address Instead Of Value

Dec 7, 2013

I've run across this issue before, but for the like of me, I can't figure out what keeps causing it. The problem compiles and runs as expected; however in the salaried object (Employee #1 in main.cpp) the console displays the number of vacation days as -858993460 instead of the value entered.

The parent Employee class is abstract with calculatePay() and displayEmployee() being pure virtualls and with a Benefits, Salaried, and Hourly class derived from it.

The Salaried displayEmployee() and the portion of the Main.cpp that contains the salaried object follows. What causing this?

Salaried displayEmployee()
Code:
void Salaried::displayEmployee()
{
cout << endl;
cout << "Employee Information" << endl;
cout << "----------------------------------" << endl;
cout << "Employee Name: " << setw(7) << FirstName << " " << LastName << endl;
cout << "Gender: " << setw(12) << Gender << endl;

[Code] .....

View 2 Replies View Related

C :: Float Showing Nothing In Printf

Oct 6, 2014

I just checking but confused with float. in that code same size int, and same type double are working but float showing nothing in printf..why?? i'm using GCC compiler int 32bit win7 os

Code:
#‎include <stdio.h>
int main() {
char arr[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
printf("Size of char=%c
", ((char *) (&arr[0]))[1]);

[Code] ....

View 14 Replies View Related

C :: Calculating And Showing RPM On Display

Feb 19, 2014

As part of a project i want to display the speed of a small wheel on a 7 segment display. I am using a hall effect sensor to pick up the pulses of the rotation. I am not sure how to write a programe on C to calculate the RPM from this....

View 4 Replies View Related

C++ :: Calculations Are Done Correctly But Showing Zero

Nov 26, 2013

#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;

[Code] ....

View 1 Replies View Related

C/C++ :: Showing The First Digit Of Zip Code?

Nov 21, 2014

My question is why my on my code there is 10 zip code and i want to show the first digit, the problem is the first digit does not match the zip code for example the zip code is 45805 it should be '5' however, my code shows other number!

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

[Code].....

View 4 Replies View Related

C++ :: CPP File Not Showing Code

Nov 19, 2013

i have been making code of a chessgame and now sddenly computer freezed and now there's not code in .cpp file! Although my .cpp file shows size of 16kb but when i open it . there's nothing except bank file

View 1 Replies View Related

C# :: Variable Showing As Not Instanced

Oct 19, 2014

I'm receiving an error that an array has not been initialized but I'm not quite sure why. Also, I realize a list may be better in this scenario but I would still like to know what I'm doing wrong.

Warning in the IDE

Warning3Field 'Routines.SvrMain.Servers' is never assigned to, and will always have its default value nullD:Google DriveCodingC# ProjectsNONameWindowsFormsApplication1WindowsFormsApplication1Routines.cs26638WindowsFormsApplication1

Error that pops on line
Servers[Index].Address = Parser.ReturnAddress(); //returns an IPAddress

Object reference not set to an instance error

ServerDetails Class
public class ServerDetails {
public IPAddress Address; { get; set; }
public int Port { get; set; }
}

[Code] ....

View 12 Replies View Related

C/C++ :: Why Invalid Letter Not Showing

Feb 29, 2012

I wanna know why the program doesnt show "Invalid Letter Entered" when i enter any letter other than A S D or M

//Processing the data
    if (letter== 'A'||'S'||'M'||'D')// checking Add, subtract, multiply or divide {
        if (letter== 'A')//Adding the integers
            cout<<"Adding two integers = "<<first + second<<endl;
        else if (letter== 'S')//Subtracting the integers  {

[code]......

View 1 Replies View Related

C++ :: Input Showing As Default Values?

Nov 30, 2013

Same solution that I was having compiler errors on yesterday. We're working with inheritance and the program is supposed to be to create and display information for default Employee objects, Hourly Employee objects and Salaried Employee objects. Everything compiles as is, but I'm running into two issues that I can't figure out.

1) In both the hourly and salaried objects, the wage, hours, and management level attributes all displaying their default values. I'm almost positive that this has something to do with the str to int and str to double conversions that I'm using (currently have atoi and atof in the file, but I've also tried stringstream, but still had to same problem). Any thoughts as to what I'm missing?

2) the assignment calls for the Benefit benefit member in Employee.h to be protected. However this makes the member unaccessible when I try to use it in the EmployeeMain.cpp in order to set the input for the Benefit class members. I had to make the Benefit benefit member public again to get it to compile. How would I set the input for the Benefit class members while the Benefit benefit member is protected?

Solution files follow:

EmployeeMain.cpp
Code:
#include "Hourly.h"
#include "Salaried.h"
void DisplayApplicationInformation();
void DisplayDivider(string);
string GetInput(string);

[Code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved