Use strlen() to get the length of a char array buffer
#include <iostream> #include <string.h> using namespace std; int main() { char buffer[80]; do { cout << "Enter a string up to 80 characters: "; cin.getline(buffer,80); cout << "Your string is " << strlen(buffer); cout << " characters long." << endl; }while (strlen(buffer)); return 0; }