Hi
i'm following a book but i don't understand std::string::size_type
and some other data types specially typedef
i see programmers use them too much.
typedef int grades[5];
grades studenA[5], studentB[5];
and
why just not use int
instead of size_type
while the result is same.
#include <iostream>
#include <string>
#include <algorithm>
int main(){
const std::string hexdigits = "0123456789ABCDEF";
std::cout << "Enter a series of numbers between 0 and 15"
<< " separated by spaces"<< std::endl;
std::string result="";
//std::string::size_type n;
int n;
while (std::cin >> n)
if (n < hexdigits.size())
result += hexdigits[n];
std::cout << "Your hex number is: " << result << std::endl;
std::cin.get();
std::cin.ignore();
return 0;
}