-
vectorivec2;
int i=0,num=0;
string s;
int main(void)
while(cin>>s) reads any string and ends with eating.
if(s=="eating") break;
If you don't want to save the previous input, you can comment it out here.
num++;Count the number of words.
cout<<"num is:"
-
Take out the first idea and count the spaces, think about it yourself and ask again.
The second idea, the state machine, can be googled.
-
1. Defining and Constructing Initialization Strings There are many constructors that can be used to initialize strings in a variety of ways.
2. Assignment, the concatenated string string is overloaded with = and other operators, making it easier to combine and concatenate strings.
3. The access character operation string can be accessed by array and subscript. You can also use the at() function to access the specified characters.
4. You can use the STL interface to understand string as a special container, and the container contains characters.
5. Compare operation ==compare and other string comparison operations, according to the order of characters in the dictionary to compare one by one.
string
int capacity()const;Returns the current capacity (i.e., the number of elements in the string that can be stored without increasing memory).
int max_size()const;Returns the length of the maximum string that can be stored in the string object.
int size()const;Returns the size of the current string.
int length()const;Returns the length of the current string.
bool empty()const;Whether the current string is empty.
void resize(int len,char c);Set the current size of the string to len and fill in the insufficient part with the character c.
-
The brother on the second floor is right, and it would be good to compare it directly.
#include
#include
using namespace std;
int main()
-
cstring seems to be in the MFC library.
String seems to be in the C++ standard library.
-
string is a string in C++. A string object is a special type of container that is specifically designed to manipulate sequences of characters. Unlike traditional C-Strings, which are just a sequence of characters in an array, which we call an array of characters, the C+ string object belongs to a class that has a lot of built-in features, is more intuitive in the way it operates, and has a lot of useful member functions.
The definition of string is: typedef basic string string;
Because ed bisects ab perpendicularly, ABE is an isosceles triangle, angle a=angle abe, and because be bisects angle abc, so angle abe = angle cbe, so angle abc = 2 * angle a, ae = be >>>More
The easiest way to do this is to create a constructor with a string parameter in form2, and then generate a form2 form. >>>More
Strengthen the re-testing work in the construction survey to reduce the occurrence of errors. >>>More
Your anomaly was triggered, but it was eaten.
Because the using statement is actually try....Finally, your ** is equivalent to. >>>More
According to the Pythagorean theorem: ab 2 = bc 2 + ac 2 gives 13 2 = 5 2 + ac 2 solution gives ac = 12 >>>More