I was trying to read in a list of numbers and letters into a std::vector<char>
. As it produced errors, I tried only to read in numbers:
#include <vector>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
vector<char> zahlen;
for (int i = 0; i < 10; ++i)
{
zahlen.push_back(i);
}
for (int i = 0; i < zahlen.size(); ++i)
{
cout<<zahlen[i];
}
cout<<endl;
return 0;
}
This produces some strange output. What am I doing wrong? How can I store multiple types of data in a vector or another container?
EDIT:
cout<<(int)zahlen[i];
This did the job for displaying the content, but how do I identify the different types of data?