Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:39:59+00:00 2026-06-15T17:39:59+00:00

I have a char array that has number 0-8 in it in char form

  • 0

I have a char array that has number 0-8 in it in char form

Board[0] = '0';
Board[1] = '1';
Board[2] = '2';
Board[3] = '3';
Board[4] = '4';
Board[5] = '5';
Board[6] = '6';
Board[7] = '7';
Board[8] = '8';

and some of them are changed to either an ‘x’ or an ‘o’ based on user input however I need to figure out a way so that I can tell the total number of them that aren’t an ‘x’ or an ‘o’.

What I mean is if say 4 of the 9 are either an ‘x’ or an ‘o’ I need to be able to get the fact that there are 5 left. I was attempting to use for each(char c in Board) and I got far enough to where I got it to list the chars that aren’t an ‘x’ or an ‘o’ but I can’t figure out how to get it to send how many are left to an int value. This is as far as I got.

    for each(char c in Board)
    {
        if (c != 'x' && c != 'o')
        {

        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:40:00+00:00Added an answer on June 15, 2026 at 5:40 pm

    You should define a counter that counts the number of these characters (by incrementing it):

    int n = 0;
    for (char c : Board)
    {
        if (c != 'x' && c != 'o')
        {
            n++; // increment n by 1
        }
    }
    
    std::cout << n << '\n'; // use the result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that has input and pointer to an array of char
I have a struct that has an array of strings (char **args). I need
I have some C+ arrays that I have built as follows: std:array<const char *,
I have an array that is like this: unsigned char array[] = {'\xc0', '\x3f',
I have extracted a MAC address into a char* array such that each section
I have a C-array that looks like this: char hexc[] = { 0x41, 0x80,
I have a string that I convert to a char array and then I
I have a question simple like that: Let user enter some words from keyboard,one
I have a structure that has an array of pointers. I would like to
I am using apache.commons.net.telnet . I have char[] array . I am calling TelnetClient.getOutputStream().write(array[i]).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.