“Peta di CPP” Kode Jawaban

C MAP

#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

Peta di 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 MAP

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

Jawaban yang mirip dengan “Peta di CPP”

Pertanyaan yang mirip dengan “Peta di CPP”

Lebih banyak jawaban terkait untuk “Peta di CPP” di C++

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya