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 7856075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:34:57+00:00 2026-06-02T20:34:57+00:00

Look t this code plz: #include <iostream> using namespace std; int main() { enum

  • 0

Look t this code plz:

#include <iostream>
using namespace std;
int main()
{

    enum object {s,k,g};
    object o,t;

    cout << "Player One: "; cin >> o;
    cout << "Player Two: "; cin >> t;

    if (o==s && t==g) cout << "The Winner is Player One.\n";
    else if (o==k && t==s) cout << "The Winner is Player One.\n";
    else if (o==g && t==k) cout << "The Winner is Player One.\n";
    else if (o==g && t==s) cout << "The Winner is Player Two.\n";
    else if (o==s && t==k) cout << "The Winner is Player Two.\n";
    else if (o==k && t==g) cout << "The Winner is Player Two.\n";
    else cout << "No One is the Winner.\n";
        return 0;
}

while compiling I will get this error:no match for 'operator>>' in 'std::cin >> o
I’m using code-blocks. so what is wrong with this code?

  • 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-02T20:34:59+00:00Added an answer on June 2, 2026 at 8:34 pm

    There is no operator>>() for enum. You can implement one yourself:

    std::istream& operator>>( std::istream& is, object& i )
    {
        int tmp ;
        if ( is >> tmp )
            i = static_cast<object>( tmp ) ;
        return is ;
    }
    

    Of course, it would be easier if you just cin an integer and cast yourself. Just want to show you how to write an cin >> operator.

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

Sidebar

Related Questions

Have a look at this code: #include <iostream> using namespace std; int main() {
Look at this code please: #include <iostream> using namespace std; class Ratio { public:
Take a look at this code: #include <iostream> using namespace std; class A {
look at this code #include<iostream> using namespace std; //Shape is an Interface Class. No
have a look at this code: #include<stdio.h> #include <unistd.h> int main() { int pipefd[2],n;
Please look this code: #include <stdlib.h> #include <stdio.h> int N, L, I; float *
First look at this code: class Program { static void Main(string[] args) { var
Take a look at this code: public class Test { public static void main(String...
look at this code: int data=5; void Thread1() { if(data==5) { //nothing } }
Take a look at this code : public class Program { [import]IMain Main {get;

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.