
C++
文章平均质量分 51
明瑶
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
struct和typedef struct
struct和typedef struct彻底明白了struct和typedef struct分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int a; }Stu; 于是在声明变量的时候就可:Stu stu1;(如果没有t原创 2016-01-23 11:34:44 · 409 阅读 · 0 评论 -
Leetcode 237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value原创 2016-05-12 20:33:36 · 329 阅读 · 0 评论 -
Vector删除指定元素
Given an array nums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your f原创 2016-05-12 17:48:52 · 1108 阅读 · 0 评论 -
p,*p,&p的区别
定义一个指针p:int *p;p:表示指向一个int型数据a的指针*p:表示p指向的数据的值a&p:表示指针p的地址,&就是取地址符的意思举个例子:房子A、B、a;A住着a,B住着Ap表示A*p表示a&p表示B原创 2016-03-06 11:15:12 · 1078 阅读 · 2 评论 -
ALGO-113 数的统计 VIP试题
问题描述 在一个有限的正整数序列中,有些数会多次重复出现在这个序列中。 如序列:3,1,2,1,5,1,2。其中1就出现3次,2出现2次,3出现1 次,5出现1次。 你的任务是对于给定的正整数序列,从小到大依次输出序列中出现的数及出现的次数。输入格式 第一行正整数n,表示给定序列中正整数的个数。 第二行是n 个用空格隔开的正整数x,代表给定的序列。输出格式原创 2016-03-03 17:07:08 · 1079 阅读 · 0 评论 -
创建数组长度可改变的动态数组
#include#includeint main(){ int *p; int n; cin>>n; p=(int *)malloc(sizeof(int)*n); return 0;}原创 2016-03-03 16:51:07 · 1168 阅读 · 0 评论 -
从键盘输入一个字符串并求出其长度
方法一:创建一个模板函数并调用#includeusing namespace std;templateint Array_Len(T &a){ return ((sizeof (a)/sizeof (a[0])));//求数组的总长度,即分配的空间}方法二:求字符串实际的长度#includeusing namespace std;in原创 2016-03-02 12:49:52 · 9969 阅读 · 0 评论 -
宏定义
#define 是定义宏#define a没有实际意义#define a 1相当于给1起了个别名原创 2016-01-25 16:20:21 · 351 阅读 · 0 评论 -
移位运算符
java中有三种移位运算符>> : 右移运算符,num >> 1,相当于num除以2>>> : 无符号右移,忽略符号位,空位都以0补齐原创 2016-01-25 15:21:02 · 397 阅读 · 0 评论 -
数组作函数的参数 和 返回值return
数组作函数的参数 和 返回值return 同其它变量一样,数组也可以作函数的参数。数组元素只能作函数实参,且同其它变量的用法没有区别。 我们已经知道,数组元素要通过数组名和相应的下标一个个地引用,而数组名可以作函数的实参和形参。当数组作为函数参数时,调用函数中的实参数组只是传送该数组在内存中的首地址,即调用函数通知被调函数在内存中的什么地方找到该数组。在前面我们已经原创 2016-01-23 20:15:33 · 1278 阅读 · 0 评论 -
Leetcode 100. Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Definit原创 2016-05-12 21:23:44 · 317 阅读 · 0 评论