for

for,第1张

#include
#include
 
using namespace std;
 
void print(vector<int> & v)
{
	for (auto x : v)
		cout << x << ' ';//11 2 3 4 55
	cout << endl;
}
 
int main()
{
	vector<int> v = { 11,2,3,4,55 };
	//print(v);//1 2 3 4 5
	for (auto x : v)
	{	
	
	cout<<x<<" "<<endl;//11 2 3 4 55
	
	}
	print(v);
 
//	system("pause");
	return 0;
}
#include
#include
#include
using namespace std;
 
unordered_map<int, int> fa, cnt;
 
int main()
{
    vector<int> nums={100, 4, 200, 1, 3, 2};

	 for (auto x : nums) {
            fa[x] = x;
            cnt[x] = 1;
            //std::cout << x << std::endl;//100 4 200 1 3 2
            cout<<fa[x]<<endl;//100 4 200 1 3 2
        }
    
    
}

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/872981.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-13
下一篇2022-05-13

发表评论

登录后才能评论

评论列表(0条)

    保存