摘要: C++ 11标准新增加了Lambda表达式,以后小函数可以直接内嵌Lambda表达式搞定了。例如排序,我们以前要这么写:#include <iostream>#include <cstdlib>#include <algorithm>bool compare( const int & a, const int & b ){ return a < b;}using namespace std;int main ( ){ int a[10] = {5,1,2,3,6,9,8,2,3,6}; sort( a, a+9, compare ); 阅读全文
posted @ 2012-10-18 21:36 叶剑飞Victor 阅读(556) 评论(0) 推荐(0) 编辑
摘要: 先上个预览再秀秀代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="zh" xml:lang="zh"><head><meta http-equiv="co 阅读全文
posted @ 2012-10-18 20:01 叶剑飞Victor 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 我们最经常遇到的验证,就是电子邮件地址验证。网站上常见。各种网页脚本也都常用“正则表达式”(regular expression)对我们输入的电子邮件地址进行验证,判断是否合法。有的还能分解出用户名和域名。现在用PHP语言实现一下电子邮件地址验证程序,用的是PHP正则表达式库。 源代码如下:<?php header ( "Content-Type: text/html; charset=UTF-8" ); $reply = ""; if ( isset($_POST["email_address"]) ) { $email_ad 阅读全文
posted @ 2012-10-18 15:04 叶剑飞Victor 阅读(57515) 评论(0) 推荐(1) 编辑
摘要: 我们最经常遇到的验证,就是电子邮件地址验证。网站上常见。各种网页脚本也都常用“正则表达式”(regular expression)对我们输入的电子邮件地址进行验证,判断是否合法。有的还能分解出用户名和域名。现在用JavaScript语言实现一下电子邮件地址验证程序,用的是JavaScript语言的正则表达式库。 源代码如下,该网页已在IE、Firefox、Chrome上验证通过:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1 阅读全文
posted @ 2012-10-18 14:09 叶剑飞Victor 阅读(11850) 评论(0) 推荐(0) 编辑
摘要: 湖南省第八届大学生计算机程序设计竞赛C题 Updating a Dictionary(题目链接)。Problem C Updating a DictionaryIn this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given an old dictionary and a new dictionary, find out what were changed.Each di... 阅读全文
posted @ 2012-10-18 11:36 叶剑飞Victor 阅读(680) 评论(0) 推荐(0) 编辑