Ha c++ progi, miert nem hasznalsz mondjuk iostreamet? Amugy az a legfobb baj, hogy hiaba futtatod az i valtozot, ha nem jarod vele a tombot.. Hatultesztelosdi itt sztem nem egyszerusit (mivel 1 dolgot egyszerusit, de lesz helyette masik).
Itt egy megoldas. Ha C kod kell, nem C++, akkor csak a kiiras/bekerest (cout, cin-es sorok) ird at a printf/scanf -es valtozatra, a tobbi maradhat. Az itemcount-ban marad, hany elem kerult be a tombbe.
#include <iostream>
using namespace std;
int main()
{
int capacity=100; int tomb[capacity]; int itemcount=0;