#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char ary[] = "Welcome to Softhunt.net";
cout << "Length of String = " << strlen(ary)<<endl;
return 0;
}
// C++ string size
str.length();
str.size(); // synonym
//me
myStr.length(); //method 1
myStr.size(); //method 2
#include <string>
#include <iostream>
int main()
{
std::string s(21, '*');
std::cout << s << std::endl;
return 0;
}
string s(n, '*');
Code Example |
---|
Cpp :: throw exception c++ |
Cpp :: pascal triangle using c++ |
Cpp :: c++ lambda |
Cpp :: find duplicate from an array c++ |
Cpp :: cannot jump from switch statement to this case label c++ |
Cpp :: int to float c++ |
Cpp :: how to append to a vector c++ |
Cpp :: reverse level order traversal |
Cpp :: log in c++ |
Cpp :: how do you wait in C++ |
Cpp :: c++ hashmaps |
Cpp :: function in struct c++ |
Cpp :: cpp return array |
Cpp :: Find minimum maximum element CPP |
Cpp :: c++ print out workds |
Cpp :: find element in vector |
Cpp :: C++ code for Dijkstra’s Algorithm |
Cpp :: how to slice vector in c++ |
Cpp :: c function as paramter |
Cpp :: vector c++ |
Cpp :: c++ elif |
Cpp :: how to create 2d array using vector in c++ |
Cpp :: hashmap c++ |
Cpp :: c ++ split_string |
Cpp :: c++ for each loop |
Cpp :: linux c++ sigint handler |
Cpp :: converting decimal to binary in cpp |
Cpp :: cpp oop |
Cpp :: dequeue c++ |
Cpp :: age in days in c++ |