# A for utasítás (számlálós ciklus)

#### Általános alakja C++-ban

```cpp
for ( KEZDETI_ÉRTÉKADÁS ; FOLYTATÓDÁSI_FELTÉTEL ; MÓDOSÍTÓ_KIFEJEZÉS)
{
    UTASÍTÁSOK;
}
```

A for ciklus úgy működik, hogy általában egy ciklusváltozót használunk melynek a kezdeti értékadás során kezdőértéket adunk. Ez után beállítjuk a folytatási feltételt. Ha a folytatási feltétel teljesül, akkor végrehajtódnak a ciklus utasításai (megtörténik az iteráció) és a módosító kifejezés segítségével a ciklusváltozó automatikusan változik.&#x20;

A módosítás legtöbbször a ciklusváltozó 1-el való növekedését jelenti (ekkor növekvő ciklusról beszélünk), de csökkenthetjük is a ciklusváltozót (ekkor csökkenő ciklusról beszélünk).

### Példa program

```cpp
#include <iostream>

using namespace std;

int main()
{
    for(short i = 1; i <= 100; i++)
    {
        cout << i << " ";
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cspp.csalex.org/10.-osztaly/a-for-utasitas-szamlalos-ciklus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
