I dont know why this doesnt work, basically I want to calcualate the letters and numbers and white spaces and so on, nothing fancy. And it does work, it does calculate everything. However I seem to be stuck in the while loop or something because I cant print it out, for example the "ch" as im trying to do in the code.
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
int main(void)
{
char bokstav;
int ch=0;
int tal=0;
int punkt=0;
int space=0;
int others=0;
std::cout << "Type a sentence:";
while (std::cin.get(bokstav))
{
if (isalpha(bokstav))
ch++;
else if (isdigit(bokstav))
tal++;
else if (ispunct(bokstav))
punkt++;
else if (isspace(bokstav))
space++;
else
others++;
//test
std::cout << ch;
}
std::cout << ch;
}