C++ String Manipulation
C++ code to count digits in a string
C++ programming language also provides a function called isdigit(int) that can be used to indicate whether a character in a string is a digit. This function takes one argument--the character(presented by its ascii value) that you want to check. In the example below we use the isdigit(int) function to count the number of digits in a string "C++ programming2011".
using namespace std;
string st="C++ programming2011";
cout<<"Number of digits:"<<count;
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
Copyright @ 2011-2013 worldbestlearningcenter. All Rights Reserved.