Created
November 21, 2014 13:29
-
-
Save oshingc/5c2c7ad77529442e62d1 to your computer and use it in GitHub Desktop.
C++ Functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STRING TO CHAR[] | |
string tmp = "cat"; | |
char tab2[1024]; | |
strcpy(tab2, tmp.c_str()); | |
ARRAY TO SET | |
std::set<T> set(begin(array), end(array)); | |
int arr{} = {1,55,4,2,35,1,5}; //declare the array | |
int arrSize = sizeof(arr)/arr[0]; //get size of the array | |
set<int> s(arr, arr+arrSize); //move the array to the set *** | |
STRING TO INT | |
atoi( str.c_str() ) | |
std::stoi( str ) | |
INT TO STRING | |
std::string s = std::to_string(42); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment