全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 894|回复: 11

【fixed】烦请大佬们帮忙看个c写的小程序,谢谢!

[复制链接]
发表于 2020-10-4 12:05:28 | 显示全部楼层 |阅读模式
本帖最后由 耳火 于 2020-10-4 13:03 编辑

zfb小额红包奉上 口令:我帮你看题哟

如题,折腾了一个上午都没折腾到位,特来loc请大佬帮忙找找bug。

bug:卡在一个地方不往下走了

题目要求和我敲的bug都在下方的压缩包里,感谢大佬们!

test.zip (48.16 KB, 下载次数: 42)

感谢风铃大佬!







发表于 2020-10-4 12:32:36 | 显示全部楼层
本帖最后由 风铃 于 2020-10-4 12:38 编辑

SubMatrix函数完全错了, 修改
  1. void SubMatrix(double a[][SIZE], double b[][SIZE], int n, int row, int col)
  2. {
  3.     int i, j, x=0, y=0;
  4.     //抽下去一项,注意判断行和列(continue实现),呵呵。
  5.     for(i=0; i < n; i++){

  6.         if(i == row){
  7.             continue;
  8.         }

  9.         y = 0;
  10.         for(j=0; j < n; j++){
  11.             if(j == col){
  12.                 continue;
  13.             }
  14.             b[x][y]=a[i][j];
  15.             y++;
  16.         }
  17.         
  18.         x++;
  19.     }
  20. }
复制代码

  1. Please enter matrix size n(1<=n<20):3
  2. Please input matrix line by line:
  3. 6 1 1
  4. 4 -2 5
  5. 2 8 7
  6. matrix a:
  7.    6.0           1.0           1.0       
  8.    4.0          -2.0           5.0       
  9.    2.0           8.0           7.0       

  10.   -2.0           5.0       
  11.    8.0           7.0       
  12. DValue of the Submatrix is  -54.0
  13.    4.0           5.0       
  14.    2.0           7.0       
  15. DValue of the Submatrix is   18.0
  16.    4.0          -2.0       
  17.    2.0           8.0       
  18. DValue of the Submatrix is   36.0
  19. result = -306.000000
复制代码
发表于 2020-10-4 12:11:37 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2020-10-4 12:14:20 | 显示全部楼层
你这个注释写的有点逗比啊
发表于 2020-10-4 12:15:55 | 显示全部楼层
超纲了, 行列式已经还给大学老师了
 楼主| 发表于 2020-10-4 12:15:56 来自手机 | 显示全部楼层
naohion 发表于 2020-10-4 12:11
GB2312编码的代码 记事本写的吧...
要看什么问题没说

codeblocks bug已经在上边说了,大佬跑一下就知道了
 楼主| 发表于 2020-10-4 12:19:34 来自手机 | 显示全部楼层
william2ct 发表于 2020-10-4 12:14
你这个注释写的有点逗比啊

写代码要笑着写
发表于 2020-10-4 12:28:09 | 显示全部楼层
本帖最后由 shc 于 2020-10-4 12:30 编辑

我这里好像没问题

  1. Please enter matrix size n(1<=n<20):2
  2. Please input matrix line by line:
  3. 1
  4. 2
  5. 3
  6. 4
  7. matrix a:
  8.    1.0     2.0
  9.    3.0     4.0

  10. result = -2.000000
复制代码
 楼主| 发表于 2020-10-4 12:33:30 | 显示全部楼层
shc 发表于 2020-10-4 12:28
我这里好像没问题

大佬你好,试3x3及以上的就不行了QAQ
 楼主| 发表于 2020-10-4 12:39:17 | 显示全部楼层
风铃 发表于 2020-10-4 12:32
SubMatrix里面if一个等于号写错了吧

谢谢大佬,我现在在吃饭,回去马上瞅
谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-4 12:12 , Processed in 0.068280 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表