随笔分类 - C/C++
摘要:总结一下,vs2010下通过测试代码质量不咋地,求指导更好的算法。 1 // LearnAlgorithm.cpp : Defines the entry point for the console application. 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 void char2float(char *chrNum, float &fNum)10 {11 if (*chrNum = '9' || chrNum == NULL)12
阅读全文
摘要:各种排序算法总结//// mySorts.c// mySorts//// Created by chen on 13-9-25.// Copyright (c) 2013年 chen. All rights reserved.//#include #include "mySorts.h"/** 原理:将数组分为无序区和有序区两个区,然后不断将无序区的第一个元素按大小顺序插入到有序区中去,最终将所有无序区元素都移动到有序区完成排序。 要点:设立哨兵,作为临时存储和判断数组边界之用。 **/void insertSort(int a[], int length){ printf
阅读全文
摘要:将matlab程序转换成C++的时候,矩阵运算真让人头疼,分享一下矩阵类的C++实现。头文件Matrix.h 1 //Matrix.h 2 //矩阵类定义 3 4 #ifndef MATRIX_H 5 #define MATRIX_H 6 #include 7 #include 8 //using namespace std; 一般头文件中使用完全限定域名字,而不是包含命名空间,防止重复包含头文件时造成的资源浪费 9 10 class Matrix 11 {12 //从流中读入矩阵13 friend std::istream& operator >> (std::istr.
阅读全文

浙公网安备 33010602011771号