
c++程序设计string类成员函数是什么
2个回答
展开全部
String constructors create strings from arrays of characters and other strings
String operators concatenate strings, assign strings, use strings for I/O, compare strings
append append characters and strings onto a string
assign give a string values from strings of characters and other C++ strings
at returns an element at a specific location
begin returns an iterator to the beginning of the string
c_str returns a non-modifiable standard C character array version of the string
capacity returns the number of elements that the string can hold
clear removes all elements from the string
compare compares two strings
copy copies characters from a string into an array
data returns a pointer to the first character of a string
empty true if the string has no elements
end returns an iterator just past the last element of a string
erase removes elements from a string
find find characters in the string
find_first_not_of find first absence of characters
find_first_of find first occurrence of characters
find_last_not_of find last absence of characters
find_last_of find last occurrence of characters
getline read data from an I/O stream into a string
insert insert characters into a string
length returns the length of the string
max_size returns the maximum number of elements that the string can hold
push_back add an element to the end of the string
rbegin returns a reverse_iterator to the end of the string
rend returns a reverse_iterator to the beginning of the string
replace replace characters in the string
reserve sets the minimum capacity of the string
resize change the size of the string
rfind find the last occurrence of a substring
size returns the number of items in the string
substr returns a certain substring
swap swap the contents of this string with another
String operators concatenate strings, assign strings, use strings for I/O, compare strings
append append characters and strings onto a string
assign give a string values from strings of characters and other C++ strings
at returns an element at a specific location
begin returns an iterator to the beginning of the string
c_str returns a non-modifiable standard C character array version of the string
capacity returns the number of elements that the string can hold
clear removes all elements from the string
compare compares two strings
copy copies characters from a string into an array
data returns a pointer to the first character of a string
empty true if the string has no elements
end returns an iterator just past the last element of a string
erase removes elements from a string
find find characters in the string
find_first_not_of find first absence of characters
find_first_of find first occurrence of characters
find_last_not_of find last absence of characters
find_last_of find last occurrence of characters
getline read data from an I/O stream into a string
insert insert characters into a string
length returns the length of the string
max_size returns the maximum number of elements that the string can hold
push_back add an element to the end of the string
rbegin returns a reverse_iterator to the end of the string
rend returns a reverse_iterator to the beginning of the string
replace replace characters in the string
reserve sets the minimum capacity of the string
resize change the size of the string
rfind find the last occurrence of a substring
size returns the number of items in the string
substr returns a certain substring
swap swap the contents of this string with another
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
void tongji(node*head) //统计男女职工人数的函数
{ int i=0,j=0;
node *p;
p=head;
while(p!=NULL)
{ if(p->sex=='m'||p->sex=='M')i++;
if(p->sex=='f'||p->sex=='F')j++;
p=p->next;}
cout<<"男职工人数为:"<<i<<endl;
cout<<"女职工人数为:"<<j<<endl;}
{ int i=0,j=0;
node *p;
p=head;
while(p!=NULL)
{ if(p->sex=='m'||p->sex=='M')i++;
if(p->sex=='f'||p->sex=='F')j++;
p=p->next;}
cout<<"男职工人数为:"<<i<<endl;
cout<<"女职工人数为:"<<j<<endl;}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询