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

  • SEARCH
  • Home
  • 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 8211107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:19:01+00:00 2026-06-07T10:19:01+00:00

It is probably very inefficient and messy but here is my problem- Where it

  • 0

It is probably very inefficient and messy but here is my problem- Where it says stuff like “zz == defo && zo == defo” The equals is underlined in red saying Error: no operator “==” matches these operands and when I run I get an error that is too long to post here- http://pastebin.com/KTEM0MZK

What am I doing wrong? Thanks in advance

Here is my code-

#include <iostream>
#include <cstdlib> // for rand() and srand()
#include <ctime> // for time()
using namespace std;

string random1(){
    srand(((time(0) - 23) * time(0)) - (9*time(0)));
  if (rand() % 2 == 0){
    return "1";
        } else {
            return "0";
        }
}
string random2(){
    srand((((time(0) - 89) * time(0)) - (9*time(0)) / 3) - 99);
  if (rand() % 2 == 0){
    return "1";
        } else {
            return "0";
        }
}
int main(){
    string zz = "-";
    string zo = "-";
    string zt = "-";
    string oz = "-";
    string oo = "-";
    string ot = "-";
    string tz = "-";
    string to = "-";
    string tt = "-";
    for(int a = 1;a<=9;a++){
        srand ( time(NULL) - 8 );
        int ran1 = rand() % 3;  
        srand ( time(NULL) * 2);
        int ran2 = rand() % 3;
        int tote = (ran1 * 10) + ran2;
        cout << endl << "format- 0 = zero, 1 = one, 2 = two" << endl;
        int input;
        cin >> input;
        if(input == 00){
            zz = "X";
        } else if(input == 01){
            zo = "X";
        } else if(input == 02){
            zt = "X";
        } else if(input == 10){
            oz = "X";
        } else if(input == 11){
            oo = "X";
        } else if(input == 12){
            ot = "X";
        } else if(input == 20){
            tz = "X";
        } else if(input == 21){
            to = "X";
        } else if(input == 22){
            tt = "X";
        }
        // now for the computers part
        if(tote == 00){
            zz = "O";
        } else if(tote == 01){
            zo = "O";
        } else if(tote == 02){
            zt = "O";
        } else if(tote == 10){
            oz = "O";
        } else if(tote == 11){
            oo = "O";
        } else if(tote == 12){
            ot = "O";
        } else if(tote == 20){
            tz = "O";
        } else if(tote == 21){
            to = "O";
        } else if(tote == 22){
            tt = "O";
        }
        printf ("|%d|%d|%d", zz, zo, zt);
        cout << endl;
        printf ("|%d|%d|%d", oz, oo, ot);
        cout << endl;
        printf ("|%d|%d|%d", tz, to, tt);

        if(zz == "X" && zo == "X" && zt == "X" || oz == "X" && oo == "X" && ot == "X" || tz == "X" && to == "X" && tt == "X" || zz == "X" && oz == "X" && tz == "X" || zo == "X" && oo == "X" && to == "X" || zt == "X" && ot == "X" && tt == "X" || zz == "X" && oo == "X" && tt == "X"){
            cout << endl << "X WINNER";
        break;
        }
        if(zz == "O" && zo == "O" && zt == "O" || oz == "O" && oo == "O" && ot == "O" || tz == "O" && to == "O" && tt == "O" || zz == "O" && oz == "O" && tz == "O" || zo == "O" && oo == "O" && to == "O" || zt == "O" && ot == "O" && tt == "O" || zz == "O" && oo == "O" && tt == "O"){
            cout << endl << "O WINNER";
            break;
        }
    }
    system("pause");
    return 0;
}
  • 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-07T10:19:04+00:00Added an answer on June 7, 2026 at 10:19 am

    You need to #include <string>, where the operator== is defined.

    And, as already stated by jrok, you are passing a std::string to printf(): use cout instead (as you already using).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a problem which is probably very easy to solve but I can't
OK, this is probably very basic, but I can't find the problem. I'm trying
This problem is probably very simple to solve but it is not clear to
This problem is probably very easy to solve but somehow I cannot find a
Not a front-end UI but have a (probably) very easy problem to fix and
This is probably very stupid question but here we go class Foo < ActiveRecord::Base
This is another probably very simple question, but I haven't been able to find
This is probably very simple but it's really confusing me. When I implement the
So this one is probably very simple, but I'm having a bit of trouble
This is probably very easy to do but for some reason I can't seem

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.