Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. wierd error!

wierd error!

Scheduled Pinned Locked Moved C / C++ / MFC
helplinux
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Snyp
    wrote on last edited by
    #1

    void player_move(){ int a = 0; g: cout << "Enter valid move (1-9):"; cin a; // line containing error if(a >= 1 && a <= 9){ if(a == 1 && b1 == " ") b1 == "O"; if(a == 2 && b2 == " ") b2 == "O"; if(a == 3 && b3 == " ") b3 == "O"; if(a == 4 && b4 == " ") b4 == "O"; if(a == 5 && b5 == " ") b5 == "O"; if(a == 6 && b6 == " ") b6 == "O"; if(a == 7 && b7 == " ") b7 == "O"; if(a == 8 && b8 == " ") b8 == "O"; if(a == 9 && b9 == " ") b9 == "O"; } else goto g; } The line that contains the error gives this "error C2146: syntax error : missing ';' before identifier 'a'" Can anyone help me try to explain why this is happening becuase when I do what the compiler says it compiles fine. please help.:confused::confused: Actual Linux Penguins were harmed in the creation of this message.

    R 1 Reply Last reply
    0
    • S Snyp

      void player_move(){ int a = 0; g: cout << "Enter valid move (1-9):"; cin a; // line containing error if(a >= 1 && a <= 9){ if(a == 1 && b1 == " ") b1 == "O"; if(a == 2 && b2 == " ") b2 == "O"; if(a == 3 && b3 == " ") b3 == "O"; if(a == 4 && b4 == " ") b4 == "O"; if(a == 5 && b5 == " ") b5 == "O"; if(a == 6 && b6 == " ") b6 == "O"; if(a == 7 && b7 == " ") b7 == "O"; if(a == 8 && b8 == " ") b8 == "O"; if(a == 9 && b9 == " ") b9 == "O"; } else goto g; } The line that contains the error gives this "error C2146: syntax error : missing ';' before identifier 'a'" Can anyone help me try to explain why this is happening becuase when I do what the compiler says it compiles fine. please help.:confused::confused: Actual Linux Penguins were harmed in the creation of this message.

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      Try cin >> a;

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      S 1 Reply Last reply
      0
      • R Ryan Binns

        Try cin >> a;

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        S Offline
        S Offline
        Snyp
        wrote on last edited by
        #3

        O jeez I got it thanks, man I don't know what the governments putting into my air!!!;P LOL sry for any inconvienience. I better take a rest lol.;) Actual Linux Penguins were harmed in the creation of this message.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups