Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

c++ syntax error help needed

Status
Not open for further replies.

HarshJain

Newbie
Newbie level 3
Joined
Jul 11, 2022
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
India
Activity points
35
Code:
else if((RI >= 181) && (RI <= 210)){
        if((ICT1 = false) || ((ICT2 = false) || (ICT3 = false))){
        cout << "ICT \n";
        if(ICT1 = false){
            ICT1 = true;
            goto endICT;
        }
        if(ICT2 = false){
            ICT2 = true;
            goto endICT;
        }
        if(ICT3 = false){
            ICT3 = true;
            goto endICT;
        }
            endICT:
    }

Howdy! This is simply an aspect of my program, and this bit of code appears a few times, with different variables and other stuff. When I compile the code, I get "error C2143: Syntax Error : missing ';' before '}'" I'm new to all this coding, and would appreciate any help! Thanks for your time! Basically, a random number is chosen, and if it's within a range, it goes through this part. This range can only be chosen 3 times because then the first 'if' would not be true. Thanks for all your help so far! Also, the error is in the 'endICT:' line.
 

Hi,

you see there are
5 times "{" and
4 times "}"
--> but the numbers have to match. Check your code.

****

I´m not familiar with C++ but I think
you have to use "==" instead of "=" within the IF command

****

Using "goto" isn´t good practice. But still it is allowed to be used and sometimes even useful.
--> read about "goto"

Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top