写得好费劲啊。找了半天错,最后发现是rpos初始化出错了。
Matrix.h:行逻辑稀疏矩阵的基本操作
enum Statuses{WRONG=-1,OK=0};
enum Max{MAX_SIZE=100,MAX_RC=20};
typedef int Status;
typedef int Elem;
typedef struct
{
int i,j;
Elem e;
}Triple;
typedef struct
{
int mu,n[......]
Author Archives: coder4
《数据结构》读书笔记 第五章 矩阵的顺序三元表存储
开始恢复写程序了,快正常了~这次的程序很难的,而且系列性啊……最让我惊诧的是看到了别人的减法算法,太牛了……
Matrix.h:定义了基本操作
#include <iostream>
using namespace std;
enum {OK=-1,WRONG=0,MAX=100};
typedef int Status;
typedef int Elem;
struct Triple
{
int i,j;[......]
namespace try catch 的小练习
小练习 没什么算法或者数据结构
#include <iostream>
namespace Fib
{
long Fib1(int n);
}
namespace Error
{
void ShowErr(int n);
}
long Fib::Fib1(int n)
{
int i;
long fib1=1,fib2=1,fib3=1;
if(n<=0||n>19)
 [......]
不定参数列表的小练习:-)
对于cstdarg宏用于不定参数列表不是很熟悉,做个小练习:-)
#include <iostream>
#include <cstdarg>
typedef int Elem;
using namespace std;
Elem MaxInt(int n,...)
{
va_list ap;
Elem max,tmp;
int i;
va_start(ap,n);
if(n<1)
&n[......]
《数据结构》读书笔记 第五章 数组的顺序存储实现
昨天读《The C++ Programing Language Special Edition》确实觉得注释是很重要的,所以今天开始所有程序都要练习注释,尽量写出好的注释来:-)
Array.h : 定义了数组的顺序存储的基本操作
#include <iostream>
#include <cstdarg>
typedef int Elem;
typedef int Status;
enum {WRONG=-1,OK=0};
struct Array
{
/*-[......]