“Karte in CPP” Code-Antworten

c Karte

#include <iostream>
#include <string>
#include <map>

using std::string;
using std::map;
map <int,string>MapName;//you can put type you want
map<int,string>::iterator iter;

int main(){
 	int i=31136;
  	string s="name;
//How you insert values
	MapName.insert(pair<int,string>(i,s));
//How you print keys and values 
  	for(iter=studentId.begin();iter!=studentId.end();iter++){
    	cout<<"Key"<<iter->first<<"Value: "<<iter->second<<endl;
    	}
//How you search data
  	if (m.find(31136) != m.end()) {
		cout << "found" << endl;
		}
	else {
		cout << "not found" << endl;
		}
	}
Dull Dolphin

Karte in CPP

#include <map>

int main(){
  //new map
  std::map <int,int> myMap;
  myMap[0] = 1;
  myMap[1] = 2;
  myMap[2] = 3;
  myMap[3] = 4;
}
Zany Zebra

c Karte

Input: nums = [1,2,3,1], k = 3, t = 0
Output: true
Blushing Bat

Ähnliche Antworten wie “Karte in CPP”

Fragen ähnlich wie “Karte in CPP”

Weitere verwandte Antworten zu “Karte in CPP” auf C++

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen