Error - int 'counter' was not declared in this scope : <pre><code>\main112.cpp    In function 'int main()':
63  36  \main112.cpp    [Error] 'counter' was not declared in this scope
28               \Makefile.win  recipe for target 'main112.o' failed
</code></pre>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;stdlib.h&gt;

using namespace std;

struct Person
{
    string name;
    string race;
    int weight;

    void write();
    void show();
    void check();
};

void Person::show()
{
    cout&lt;&lt;"ÔÈÎ: "&lt;&lt;name&lt;&lt;endl;
    cout&lt;&lt;"Íîìåð ðåéñà: "&lt;&lt;race&lt;&lt;endl;
    cout&lt;&lt;"Âåñ áàãàæà: "&lt;&lt;weight&lt;&lt;endl;
}

void Person::write()
{
    cout&lt;&lt;"Ââåäèòå ÔÈÎ: ";
    getline(cin,name);
    cout&lt;&lt;"Ââåäèòå íîìåð ðåéñà: ";
    getline(cin,race);
    cout&lt;&lt;"Ââåäèòå âåñ áàãàæà: ";
    cin&gt;&gt;weight;
    cin.ignore();
}

void Person::check()
{
    int counter = 0;
    if(weight&gt;10)
    {
        counter++;
    }
}

int main()
{
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    setlocale(0, "Russian");


    Person* persons=new Person[4];
    for (int i = 0; i &lt; 4; i++)
    {
        persons[i].write();
    }
    for (int i = 0; i &lt; 4; i++)
    {
        persons[i].show();
        persons[i].check();
    }
    cout&lt;&lt;"Ñ áàãàæîì áîëüøå 10 êã: "&lt;&lt;counter&lt;&lt;" ÷åëîâåê"&lt;&lt;endl;

    delete[] persons;
    return 0;
}
</code></pre>

<p>Program that works the way its coded and should work, without this problem</p>

<p>Homework:</p>

<p>Write a program for processing passenger information. Information includes: 
1) Full name of the passenger.
2) Flight number. 
3) Luggage weight 
The program should allow the user to: 
1) Read data from the keyboard and display it. 
2) Calculate the number of passengers with the weight of baggage which is more than 10 kg</p>
