mam taki problem że chce by funkcja itoa zwróciła mi liczbę do tablicy charów ale zawsze mam 0 lub jak nie zrobię przez referencja(nie wiem czy dobrze pamiętam) to nic się nie pojawia.
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
int main()
{
int how_many_step = 0;
std::cin >> how_many_step;
int enter_numbers = 0;
char enter_numbers_tab[100];
while (how_many_step > 0)
{
std::cout << "pierszy while: " << std::endl;
int index = 0;
while ( (std::cin.get() >> enter_numbers) != '\n')
{
std::cout << "drugi while: " << std::endl;
if (index % 2 == 0 || index == 0)
{
char result ;
std::cout << "pierszy if: " << std::endl;
itoa( enter_numbers , &result, 10);
std::cout << "to jest result" << result << std::endl;
enter_numbers_tab[index] = result ;
std::cout << "tab: " << enter_numbers_tab[index] << std::endl;
++index;
}
else if (index % 2 == 1)
{
std::cout << "drugi if: " << std::endl;
enter_numbers_tab[index] = ' ';
std::cout << "tab: " << enter_numbers_tab[index] << std::endl;
++index;
}
}
for (int i = 0 ; i < index ; ++i)
{
std::cout << "tyle wynosi index: " << index << std::endl;
std::cout << "pierszy for: " << std::endl;
std::cout << enter_numbers_tab[i];
}
--how_many_step;
}
return 0;
}