Zdravim. Zkousel jsem napsat v C++ prevodnik z Dekadicky soustavy na Binarni soustavu ale nejak mi to nechce dohromady vypsat udaje. Nevíte v cem mam chybu?
[code]#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
//<< >>
int Prevod(int cislo);
int StringToInt(string Cislo);
int main(int argc, char *argv[])
{
string number;
cout << "Zadej Dec cislo na prevod do Bin : ";
cin >> number;
StringToInt(number);
cout << endl << endl << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
int Prevod(int Decimal)
{
string BinaryResult;
int Bin;
int i = 0;
int End;
while(Decimal > 0)
{
Bin = Decimal % 2;
BinaryResult[i] = Bin;
Decimal = Decimal / 2;
i++;
}
End = i;
for(int a = End; 0 > a; a--)
{
cout << BinaryResult[a] << "-";
}
}
int StringToInt(string Number)
{
istringstream Stream(Number);
int num;
Stream >> num;
Prevod(num);
}
[/code]