Line 34 and 35 won't execute unless I insert them into the for loop.

#include <iostream>

using namespace std;

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


    for ( int inte = 1; inte = 1; )
    {
        cin>> intege;
        cin.ignore();
        cout<<"Please enter it again.";
        cin>> integ;
        cin.ignore();

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

        }

        else
        {
        inte=1;
        cout<<"Your inputs don't quite seem to match. Please type them again."<<endl;
        }

    }
    cout<<"uglypeople\n";
    return(0);
}

Not surprising because of a tiny bug in your loop: You wrote: for( int inte = 1; inte = 1; ) { } Now a for loop has four parts, first an initializer, that goes from the first open bracket to the semi-colon. Second a conditional, that goes between the first and second semi colon, Next is post iteration statement, that goes after the second semi-colon. Finally there is the loop block that goes between the two braces { }.

The loop is done this way.
(a) Carry out whatever is in the initialization statement
(b) Test the conditional.
-- If the conditional is FALSE : leave the loop block -- Do nothing more.
-- if the conditional is TRUE : continue to (c)
(c) Execute the loop block.
(d) Execute the loop iteration statement
(e) goto (b).

So in your case:
(a) you create an integer inte. Then it is set to 1.
(b) Determine that inte=1 is TRUE. That is because ALL integer assignments of any value other than 0 are true.
(c) execute loop block
(d) Nothing to do
(e) Go to (b)

Thus you can never get out of your loop. That is why 34/35 dont get run.

Also please please call your variables something slightly more descriptive, using inte, integ intege is asking to make a typo and cause piles of difficulty finding the bug.

The solution I found was to correct my mistake involving my conditional, in which I wrote:

for( int inte = 1; inte = 1; ) { }

I changed it to:

for( int inte = 1; inte == 1; ) { }
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.