C Methods
C Methods
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#define FAST_IO (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
void solve(){
//code
}
int32_t main()
{
FAST_IO;
long long TC = 1;
cin >> TC;
while (TC--)
solve();
}
#include <vector>
vect<int> vec;
substr(pos, len): // Returns a substring of the string starting at the specified position with the specified length.
find(str, pos): //Searches for the first occurrence of another string within the current string, starting from the
specified position
.
rfind(str, pos): //Searches for the last occurrence of another string within the current string, starting from the
specified position.
find_first_of(str, pos): //Searches for the first occurrence of any character in another string within the current string, starting
from the specified position.
find_last_of(str, pos): //Searches for the last occurrence of any character in another string within the current string, starting
from the specified position.
find_first_not_of(str, pos): // Searches for the first occurrence of any character not in another string within the current string,
starting from the specified position.
find_last_not_of(str, pos): //Searches for the last occurrence of any character not in another string within the current string,
starting from the specified position
.
compare(str): Compares the string with another string.
#include <set>
#include <map>
#include <queue>
std::queue<int> myQueue;
// output it
while (!myQueue.empty()) {
std::cout << myQueue.front() << " "; // Output the front element
myQueue.pop(); // Remove the front element
}
#include <stack>
std::stack<int> myStack;
#include <list>
std::list<int> myList;
#include <cmath>
C++: % operator
Minimum and Maximum: Finding the minimum or maximum of two numbers.