验证demo
// chenwenjun.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <list>
//.........结构体指针的使用 和 list缓存指针
//struct Test
//{
// int len;
// char* point;
//};
//
//class A
//{
//public:
// A(){}
// ~A(){}
//
// void push();
// void pop();
//private:
// std::list<Test*> test_list_;
//};
//
//
//void A::push()
//{
// Test* test = new Test;
// test->len = 1995;
// test->point = new char[1995];
// test_list_.push_back(test);
//}
//
//void A::pop()
//{
// Test* test = test_list_.front();
// std::cout << test->len << std::endl;
//}
//
//int main()
//{
// A a;
// a.push();
// a.pop();
//
// system("pause");
//}
//...........二级指针申请内存,相当于二维数组
//struct A
//{
// int a;
//};
//
//int main()
//{
// A* a = new A[100];
// a[2].a = 100;
// //a[101].a = 101;
//
// A** aa = (A**) new int[100];
// for (int i = 0; i< 100; i++)
// {
// aa[i] = new A();
// }
// //aa[99][998].a = 1;
// aa[0][2000].a = 1;
//
//
// std::cout << a[2].a << std::endl;
// std::cout << aa[0][2000].a << std::endl;
// system("pause");
//}
//...................若想改变指针的地址需要传 二级指针 或者 一级指针的引用
// void test(char *p)
//
// {
//
// printf("[test1][p]:%p.\n", p);
//
// printf("[test2][p]:%s.\n", p);
//
// p = (char *)malloc(10);
//
// strcpy(p, "ABCDE");
//
// printf("[test3]malloc之后.....\n");
//
// printf("[test4][p]:%p.\n", p);
//
// printf("[test5][p]:%s.\n", p);
//
// free(p);
//
// }
//
//
//
// int main()
//
// {
//
// char b[6] = "abcde";
//
// char *a = b;
//
// printf("[main1][a]:%p.\n", a);
//
// printf("[main2][a]:%s.\n", a);
//
// test(a);
//
// printf("[main3][a]:%p.\n", a);
//
// printf("[main4][a]:%s.\n", a);
//
//
// system("pause");
// return 0;
//
// }
//......对象无法访问私有析构函数, list内是指针时,需要对迭代器取*
// struct S
// {
// int a;
// };
//
//
// class A
// {
// public:
// A() {
//
// }
// private:
// ~A()
// {
// std::cout << "ok...!\n";
// }
//
// };
//
// int main()
// {
// std::list<S*> s_list_;
// S s;
// s_list_.push_back(&s);
//
// for (std::list<S*>::iterator iter; iter != s_list_.end(); iter++)
// {
// S* s = *iter;
// std::cout << s->a << std::endl;
// std::cout << (*iter)->a << std::endl;
// }
//
//
//
// return 0;
// }
//..........int型强赋值给char型后会发生什么
// int main()
// {
// char a[10];
// a[0] = 2;
// //printf("%d\n", a[0]);
//
// if (2 == a[0])
// {
// std::cout << (int)a[0] << std::endl;
// printf("%d\n", a[0]);
// }
// system("pause");
// }
//........... 长字节赋给短字节有可能会被截断,例如char是一个字节,int为4个字节,
// 2在内存中其实是 00000000 00000000 00000000 00000010,char只获取 00000010,因此还没被截断,
// 超过255就会被截断。std::cout会默认匹配类型打印,a实际是个数组,若只想打印a[0],需要强转int
验证demo的更多相关文章
- @valid表单验证demo
springMVC 表单验证demo 视图层使用的是jsp
- spring mvc 建立下拉框并进行验证demo
原文出处:http://howtodoinjava.com/spring/spring-mvc/spring-mvc-populate-and-validate-dropdown-example/ 该 ...
- python_appium 之使用Appium Inspector定位工具进行元素识别,编写验证demo
一.前提条件 appium环境搭建完成,模拟器Genymotion 安装完成,且已经下载成功了模拟设备 二.元素识别操作步骤及demo 1.进入appium如下菜单 2.填写Desired Capab ...
- struts2学习笔记--拦截器(Interceptor)和登录权限验证Demo
理解 Interceptor拦截器类似于我们学过的过滤器,是可以在action执行前后执行的代码.是我们做web开发是经常使用的技术,比如权限控制,日志.我们也可以把多个interceptor连在一起 ...
- Django通过中间件实现登录验证demo
前提:中间件版的登录验证需要依靠session,所以数据库中要有django_session表. from django.conf.urls import url from django.contri ...
- 文件完整性hash验证demo(python脚本)
一个简单的文件完整性hash验证脚本 #!/usr/bin/env python # -*- coding: utf- -*- import os import hashlib import json ...
- angular1 表单验证demo
这是一个angular1 验证表单的小栗子: 先看代码: <div ng-controller="myController"> <form name=" ...
- 邮箱格式验证demo
<html> <head> <script type="text/javascript"> function validate_email(fi ...
- JS表单验证-12个常用的JS表单验证
JS表单验证-12个常用的JS表单验证 最近有个项目用到了表单验证,小编在项目完结后的这段时间把常用的JS表单验证demo整理了一下,和大家一起分享~~~ 1. 长度限制 <p>1. 长度 ...
随机推荐
- springmvc 在非controller下使用@autowired
在SpringMVC框架中,我们经常要使用@Autowired注解注入Service或者Mapper接口,我们也知道,在controller层中注入service接口,在service层中注入其它的s ...
- htop的安装和使用
1.Ubuntu16.04中htop安装很简单 sudo apt-get install htop 2.htop的使用,直接以普通用户输入htop命令即可执行 关于其基本介绍和使用方式在见下 http ...
- css3的特性
增加了媒体查询.圆角边框.过渡动画效果
- JavaScript杂谈(第六天)
js中可以使用Function创建函数 var func=new Function(); 这个对象可以将字符串转换为函数 var func=new Function("console.wri ...
- js比较洋气的写法
案例一:使用js的构造方法生成js对象.给该对象赋属性值或function 案例二:使用json的代码风格,完成同样的功能. <!DOCTYPE html> <html> &l ...
- 最新版SEMCMS_PHP_3.5 过滤不严导致sql注入
一.漏洞分析 在分析过程中看到网上已经有人发现semcms V2.4存在过滤不严导致sql注入的漏洞,不知道咋还没改,而且最新版过滤的关键字更少了. 首先查看首页文件index.php的代码 < ...
- HTML中引入CSS的四种常用方法及各自的缺点
在HTML中引入CSS的方法主要有四种,它们分别是行内式.内嵌式.链接式和导入式. 1.行内式 行内式是在标记的style属性中设定CSS样式.这种方式没有体现出CSS的优势,不推荐使用.格式如下: ...
- skimage
它是由python语言编写的, 子模块名称 主要实现功能 io 读取.保存和显示图片或视频 data 提供一些测试图片和样本数据 color 颜色空间变换 filters 图像增强.边缘检测.排序 ...
- supervisor支持python虚拟环境venv
在项目中使用supervisor时,如何在虚拟环境下启动一直存在些小问题. 比如我要写 Cesi程序的监听,我是手动安装的执行之前 要先加载环境source venv/bin/activate 所以写 ...
- nil和Nil及NULL的区别(仅作记录)
今天在研究红黑树的时候一直提到一个NIL节点,百度了一下,这里仅作记录 nil是一个对象值,如果要把一个对象设置为空的时候就用nil.Nil是一个类对象的值,如果要把一个Class类型的对象设置为空的 ...