【无标题】

2022-04-08----算法库—sort—排序

#include<cstdio>
#include<iostream>
#include<algorithm>//算法库 
using namespace std;
int a[10];
int main(){
	int i=0;
	for(i=0;i<10;i++){
		a[i]=i;
	}
	for(i=0;i<10;i++){
		printf("%d",a[i]);
	}
	sort(a,a+10,greater<int>());
	/*
	sort ----C++里的排序函数,默认从小到大排序,
	sort(首地址,尾地址+1,greater<int>());-----greater 从大到小排, 
	*/ 
	printf("\n");
	for(i=0;i<10;i++){
		printf("%d",a[i]);
	}
}

2022-4-8 -----容器-----集合set

#include<iostream>
#include<string>
#include<set> //容器---集合
/*
insert ----插入元素
erase-----删除一个元素
count-----统计集合中元素的个数
size-------获取元素个数
clear-------清空(会清空内存) 
*/ 
#include<algorithm>//算法库 
using namespace std;

int main(){
	set<string> country;
	country.insert("China");
	country.insert("America");
	country.insert("France");
	country.insert("China");
	set<string>::iterator it;
	for(it=country.begin();it!=country.end();it++){
		cout<<*it<<endl;
	}
	
	country.erase("America");
	country.erase("EngLand");
	if(country.count("China")){
		cout<<"在里面"<<endl;
	}else{
		cout<<"不在"<<endl;
	}
	for(it=country.begin();it!=country.end();it++){
		cout<<*it<<endl;
	}
	country.clear();
	return 0;
	
}

2022-4-8-------集合set—

在这里插入图片描述

2022-4-9—被字符串+指针搞的一天
string s ;----字符串可以看出一个数组(只出现在c++)

今天又碰到了weer(int &a)——————这种引用,
这种引用只出现在C++中哈

在c中要引用------用指针啊;

明日复习*p+±---- * ++p

蓝桥杯真的无语了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值