I don't know why my compiler didn't like my for loop

#include <iostream>

using namespace std;

int main()
{
    cout<<"Please enter an integer.\n";
    int intege;

    cin>> intege;
    cin.ignore();
    cout<<"Please enter it again."

    for ( int inte = 1; inte = 1; ) {
        cin>> integ;

        if (intege==integ) {
        inte=0
        cout<<"Thank You, please hit enter to end the program."
        }
        else {
        inte=1
        cout
        }
    }
    return(1);
}

Recommended Answers

All 3 Replies

Hint:

int i=0;
for(i=0; i<100;i++){
    cout<<i<<"\n";
}

I'm not quite sure what you meant by that, but apparently it was because I forgot a semicolon. Funny how it marks the next command as wrong.

I'm not quite sure what you meant by that, but apparently it was because I forgot a semicolon. Funny how it marks the next command as wrong.

Because semicolon is a "punctuation mark". It sees two statements as one statement.
like I Love Tanzania It is most beautiful! (Two sentence but missing full stop)
The difference here is, you are more intelligent than a compiler

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.