/*看系统用几个核就跑几个可以实现一个逻辑核CPU 100%*/
#include "stdio.h"
#include "math.h"
int main (int argc,char *argv[])
{
float f=0;
printf("hello! CPU stress start for one core!\n");
...
分类:
系统相关 时间:
2015-07-23 17:47:41
阅读次数:
246
getopt函数原型:getopt.getopt(args, shortopts, longopts=[])参数解释:
args:args为需要解析的参数列表。一般使用sys.argv[1:],这样可以过滤掉第一个参数(ps:第一个参数是脚本的名称,它不应该作为参数进行解析)
shortopts:简写参数列表
longopts:长参数列表
返回值:
opts:分析出的(option, value)列...
分类:
编程语言 时间:
2015-07-23 15:48:17
阅读次数:
161
其实同C语言和Java,OC中也是有switch多分支语句,也可称之为开关语句。语法也是极为相似的。下面我们来慢慢研究switch。
(一)代码一:
int main(int argc, const char * argv[]) {
@autoreleasepool {
int i=6;
switch (i) {
...
分类:
其他好文 时间:
2015-07-23 15:45:44
阅读次数:
96
#include
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
map m;
typedef map::value_type vt;
for(int i=0; i<50; i++)
{
int val =...
分类:
其他好文 时间:
2015-07-23 15:40:54
阅读次数:
166
问题描述: 当用ios::in模式打开文件时,使用seekg和tellg读取文件的长度,将读取文件内容输出到控制台,发现乱码。 1 int _tmain(int argc, _TCHAR* argv[]) 2 { 3 using namespace std; 4 ifstream ...
分类:
移动开发 时间:
2015-07-23 15:23:09
阅读次数:
219
在OC中,除了while这种循环方式外,还有另外for循环和do-while循环,它们在不同的业务逻辑下会有不同的作用。可以和C语言和Java对比着学习。
(一)代码一:
int main(int argc, const char * argv[]) {
@autoreleasepool {
for (int i = 0; i < 5; i++) {
...
分类:
其他好文 时间:
2015-07-23 11:58:53
阅读次数:
224
//
// main.m
// 04-new方法的实现原理
#import
#import "Person.h"
#import "Student.h"
int main(int argc, const char * argv[]) {
/*
Person * p = [[Person alloc] init];
[p run];
...
分类:
其他好文 时间:
2015-07-23 09:35:14
阅读次数:
122
/*
1.将可变字符串 @"When I was young, I loved a girl in neighbor class."中,从 young提取到girl。替换 成@"a teacher, I rather to teach student "。
*/
#import
int main(int argc, const char * argv[])
{
@autorele...
分类:
其他好文 时间:
2015-07-23 09:34:27
阅读次数:
131
//
// main.m
// 属性生成器
#import
#import "Person.h"
int main(int argc, const char * argv[]) {
Person * p = [[Person alloc] init];
[p setAge:10];
[p setName:@"小明"];
/*...
分类:
其他好文 时间:
2015-07-23 09:32:52
阅读次数:
139
#include "stdafx.h"using namespace cv;int main(int argc, char** argv){ Mat img=imread("d:/pic/lena.jpg"); imshow("src",img); CV_Assert(!img.e...
分类:
编程语言 时间:
2015-07-23 07:03:11
阅读次数:
149