虫虫首页|资源下载|资源专辑|精品软件
登录|注册

cols

  • 矩阵运算的算法 用Type类数组创建矩阵对象 matrix(int rows,int cols) //创建矩阵,值为0 matrix(int n) //创建单位阵 matrix(c

    矩阵运算的算法 用Type类数组创建矩阵对象 matrix(int rows,int cols) //创建矩阵,值为0 matrix(int n) //创建单位阵 matrix(const matrix &) //拷贝构造函数 BOOL Ismatrixf(){ return (rows==cols) } //判断矩阵是否为方阵 modifyrowscols(int rows,int cols) //修改矩阵的行列数 ~matrix() {delete []elems } //析构函数

    标签: matrix int Type cols

    上传时间: 2015-07-14

    上传用户:水口鸿胜电器

  • (1) 设计和编写代表矩阵的Matrix类。该类包括矩阵行列数变量int rows和int cols

    (1) 设计和编写代表矩阵的Matrix类。该类包括矩阵行列数变量int rows和int cols,矩阵数据数组double data[][],构造方法Matrix()、Matrix(int rows,int cols)、Matrix(int rows,int cols,double data[][]),获取某元素值的方法getData(int row,int col),设置某元素值的方法setData(int row,int col,double value),计算两个矩阵的乘积的方法multiply(Matrix m)以及toString()等内容。

    标签: int Matrix cols rows

    上传时间: 2016-08-19

    上传用户:qiao8960

  • form = new_form(fields) scale_form(form, &rows, &cols) win = newwin(rows+3, cols+4, 3, 20)

    form = new_form(fields) scale_form(form, &rows, &cols) win = newwin(rows+3, cols+4, 3, 20) subwin = derwin(win, rows, cols, 1, 2) set_form_sub(form, subwin) box(win, 0, 0) keypad(win, TRUE) post_form(form) refresh() wrefresh(win) wrefresh(subwin) //设置覆盖模式 form_driver(form, REQ_OVL_MODE)

    标签: form cols rows scale_form

    上传时间: 2017-06-11

    上传用户:wff

  • int show_char(int n, const char *name, chtype code) { const int height = 16 int row = 4 + (

    int show_char(int n, const char *name, chtype code) { const int height = 16 int row = 4 + (n height) int col = (n / height) * cols / 2 mvprintw(row, col, " *s : ", cols/4, name) addch(code) return n + 1 }

    标签: int const show_char chtype

    上传时间: 2017-06-11

    上传用户:3到15

  • 数组子系统

    #include <stdio.h> #include <stdlib.h> #define SMAX 100 typedef struct SPNode { int i,j,v; }SPNode; struct sparmatrix { int rows,cols,terms; SPNode data [SMAX]; }; sparmatrix CreateSparmatrix() { sparmatrix A; printf("\n\t\t请输入稀疏矩阵的行数,列数和非零元素个数(用逗号隔开):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t输入非零元素值(格式:行号,列号,值):"); scanf("%d,%d,%d",&A.data[n].i,&A.data[n].j,&A.data[n].v); } return A; } void ShowSparmatrix(sparmatrix A) { int k; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { k=0; for(int n=0;n<=A.terms-1;n++) { if((A.data[n].i-1==x)&&(A.data[n].j-1==y)) { printf("%8d",A.data[n].v); k=1; } } if(k==0) printf("%8d",k); } printf("\n\t\t"); } } void sumsparmatrix(sparmatrix A) { SPNode *p; p=(SPNode*)malloc(sizeof(SPNode)); p->v=0; int k; k=0; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { for(int n=0;n<=A.terms;n++) { if((A.data[n].i==x)&&(A.data[n].j==y)&&(x==y)) { p->v=p->v+A.data[n].v; k=1; } } } printf("\n\t\t"); } if(k==1) printf("\n\t\t对角线元素的和::%d\n",p->v); else printf("\n\t\t对角线元素的和为::0"); } int main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t      稀疏矩阵的三元组系统       "); printf("\n\t\t*********************************"); printf("\n\t\t      1------------创建          "); printf("\n\t\t      2------------显示          "); printf("\n\t\t      3------------求对角线元素和"); printf("\n\t\t      4------------返回          "); printf("\n\t\t*********************************"); printf("\n\t\t请选择菜单号(0-3):"); scanf("%d",&choice); switch(choice) { case 1: A=CreateSparmatrix(); break; case 2: ShowSparmatrix(A); break; case 3: SumSparmatrix(A); break; default: system("cls"); printf("\n\t\t输入错误!请重新输入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }

    标签: 数组 子系统

    上传时间: 2020-06-10

    上传用户:ccccy