C++ while statement Counts the number of letters in the user's first name
#include <iostream> using namespace std; int main()// w ww. j a va 2 s. c o m { char name[15]; int count=0; // Get the user's first name cout << "What is your first name? "; cin >> name; while (name[count]) { count++; } cout << "Your name has " << count << " characters"; return 0; }