Answers for "STL c++"

C++
1

strcmp c++

#include<stdio.h> 
#include<string.h> 


int main() 
{  
      
    char char1[] = "coucou"; 
    char char2[] = "coucou"; 
      
  	if( strcmp(char1, char2) == 0 )
       printf("Strings are the same");
  
  	else
      prinf("Strings are differentes");
  
  
    return 0; 
}
Posted by: Guest on July-09-2020
5

STL c++

Good Website to learn:
https://en.cppreference.com/w/cpp/container
https://www.cplusplus.com/reference/stl/
https://www.geeksforgeeks.org/the-c-standard-template-library-stl/
Posted by: Guest on May-06-2021
2

map in c++

#include <bits/stdc++.h>
#include <iostream>
#include <map>
using namespace std;
void mapDemo(){
	map<int, int> A;
	A[1] = 100;
	A[2] = -1;
	A[3] = 200;
	A[100000232] = 1;
	//to find the value of a key
	//A.find(key)
	
	//to delete the key
	//A.erase(key)
	
	map<char, int> cnt;
	string x = "Sumant Tirkey";
	
	for(char c:x){
		cnt[c]++;//map the individual character with it's occurance_Xtimes
	}
	
	//see  how many times a and z occures in my name
	cout<< cnt['a']<<" "<<cnt['z']<<endl;
	
} 
	
int main() {
	mapDemo();
	return 0;
}
Posted by: Guest on December-04-2020
-1

strcmp c++

int strcmp ( const char * str1, const char * str2 );

// returning value | indicates
// <0	the first character that does not match has a lower value in ptr1 than in ptr2
// 0	the contents of both strings are equal
// >0	the first character that does not match has a greater value in ptr1 than in ptr2
Posted by: Guest on December-07-2020

Browse Popular Code Answers by Language