上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: 1、单个的字符或者数字 void swap(int *a,int *b) { int temp=*a; *a=*b; *b=temp; } int main() { int a=10,b=100; swap(&a,&b); cout<<a<<"\t"<<b<<endl; return 0; } 2、字符串的情况(利用指向指针的指... 阅读全文
posted @ 2015-07-11 15:46 WQZ321123 阅读(591) 评论(0) 推荐(0) 编辑
摘要: 1、单纯统计单词个数,单词与单词之间只考虑空格的情况 // word_statistic.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include using namespace std; #define M 10000 #define N 20 int _tmain(int argc, _TCHAR* argv[... 阅读全文
posted @ 2015-07-10 23:22 WQZ321123 阅读(1075) 评论(0) 推荐(0) 编辑
摘要: 当你输入一个网址的时候,实际会发生什么? 原文:http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/ 译文:http://www.cnblogs.com/wenanry/archive/2010/02/25/1673368.html 作为一个软件开发者,你一定会对网络应用如何工作有一个完整的层次化... 阅读全文
posted @ 2015-07-03 15:40 WQZ321123 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: // demo1.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include using namespace std; #include #include #include #include using namespace cv; int main() { Mat frame; //mat数据类型 ... 阅读全文
posted @ 2015-06-30 22:12 WQZ321123 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 2.2 长度为n的数组乱序存放着0至n-1. 现在只能进行0与其他数的swap,请设计并实现排序。 这题有一个隐含条件:即数组元素是连续的,即0——n-1,当你排好序后,你会发现数组元素和该元素的下标是相等的。 思路:以数组2 0 3 1为例 1、首先a[0]=2,按照上述条件它应该放在a[2]的位置上。因为只允许0元素和其他元素的交换。所以不能直接交换a[0]和a[2],所以将0元素和a[... 阅读全文
posted @ 2015-06-30 22:04 WQZ321123 阅读(732) 评论(0) 推荐(0) 编辑
摘要: 素数是什么大家应该都知道,一个数是不是素数也很简单。 一下是代码,分别由两个函数。一个函数实现判断一个数是不是素数,另外一个函数实现输出小于等于一个特定数字的所有素数。 #include "stdafx.h" #include using namespace std; //Display_sushu(int m)函数输出小于等于m的所有素数 void Display_sushu(int... 阅读全文
posted @ 2015-06-30 21:48 WQZ321123 阅读(3706) 评论(0) 推荐(0) 编辑
摘要: VS2010 代码自动对齐 快捷键 先全选代码 ctrl+K+F MATLAB代码自动对齐 快捷键 先全选代码 ctrl+I 阅读全文
posted @ 2015-06-24 22:51 WQZ321123 阅读(1050) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://blog.csdn.net/ylf13/article/details/13627263 #include "stdafx.h" //============================================================================ // Name : CompetitionWinner.cpp //... 阅读全文
posted @ 2015-06-24 22:07 WQZ321123 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 计算机随机生成10000个数,让算法排序。花费时间如下: 代码: // KindsOfSort.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; #define N 10000 //插入排序 稳定的排序算法 时间复杂度O(n^2) voi... 阅读全文
posted @ 2015-06-18 19:57 WQZ321123 阅读(647) 评论(0) 推荐(0) 编辑
摘要: 前记:干他娘的,这么简单的排序居然还要想好久,关键是之前都是理解了的(大概几年前吧。。。),可能是没有看到图,所以我一直觉得有图片的话理解会容易的多。。。 思路:for循环共两层,内存循环将一个最大的数(按照从小到大顺序)移动到当前数组的末尾,内层循环负责记录按照内层循环的移动方式,排序好一个数组要多少次。 上图: 上代码: // 冒泡排序.cpp : 定义控制台应用... 阅读全文
posted @ 2015-06-13 19:13 WQZ321123 阅读(151) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页