![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
程序设计
YesterdayLee
这个作者很懒,什么都没留下…
展开
-
C++标准模板库(STL)整理之set
set set即集合,是一个内部自动有序而且不含有重复元素的容器。 set的定义方式与vector相同,详情可见vector整理 除了vector和string之外的STL容器都不支持(it+i)的访问方式,只能用*it的方式取出该位置元素* set内的元素自动递增排序,而且自动去除重复元素 set常用函数实例解析 (1)insert() (2)find() find(value)返set中对应值为value的迭代器,时间复杂度为O(logN),N为set内的元素个数。 set最主要的作用是自动去重并按原创 2020-11-04 10:32:15 · 151 阅读 · 0 评论 -
C++标准模板库(STL)整理之vector
vector vector也叫变长数组,即“长度根据需要而自动改变的数组”。 在编写C++程序时使用vector,需要加上以下头文件和语句: #include<vector> using namespace std; 1.vector的定义 vector<typename> name; 其中typename指的是类型,name则指变长数组名。在使用时,typename可以是int,double,char等任意的基本类型,也可以是结构体类型,除此之外,还可以是STL标准容器,如vect原创 2020-10-30 17:31:34 · 208 阅读 · 0 评论 -
PAT甲级 1011 World Cup Betting (20分)
1011 World Cup Betting (20分) 1.题目描述 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football be原创 2020-10-15 23:43:37 · 185 阅读 · 0 评论 -
PAT 甲级1005 Spell It Right (20分)
PAT 甲级1005 Spell It Right ( 题目详情 Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Each case occupies one line原创 2020-10-15 13:58:44 · 107 阅读 · 0 评论 -
PAT甲级 1001 A+B Format (20分)
PAT甲级 10011 A+B Format (20分) 题目描述 Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Specification: Each input file contains one test c原创 2020-10-13 11:31:59 · 124 阅读 · 0 评论 -
C关于%c、%s、getchar()、gets()的区别
C关于%c、%s、getchar()、gets()的区别 %c用于接收单个字符,可以接收用户输入的空格和换行。 %s可用于接收一个字符数组,例如 char str[10]; scanf("%s",str); 当用户输入空格或者换行时,表示字符串结束。 getchar用于接收单个字符,也可以接收用户输入的空格和换行。 char c; c=getchar(); getchar; 例如在这里输入一个字符a之后,接着输入的换行会被末行的getchar接收。 gets用于接收字符串,可以把空格作为字符串元素接收原创 2020-05-28 08:36:15 · 1429 阅读 · 0 评论