| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2976 人关注过本帖, 1 人收藏
标题:难题 求高手帮忙
只看楼主 加入收藏
yk19880525
Rank: 1
来 自:江汉大学
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-5-5
收藏(1)
 问题点数:0 回复次数:39 
难题 求高手帮忙
定义以下6*6阶方阵,并按以下数据进行初始化,编一程序,按12345678.。。。顺序输出数据。
int a[6][6]=
{1, 2, 6, 7,15,16,
 3, 5, 8,14,17,26,
 4, 9,13,18,25,27,
10,12,19,24,28,33,
11,20,23,29,32,34,
21,22,30,31,35,36
};
搜索更多相关主题的帖子: 难题 定义 int 
2008-05-05 22:31
PcrazyC
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:5652
专家分:0
注 册:2006-10-20
收藏
得分:0 
就是将数组中的数据从小到大输出,冒泡排序......

雁无留踪之意,水无取影之心
2008-05-05 22:36
liyanhong
Rank: 3Rank: 3
来 自:水星
等 级:禁止访问
威 望:8
帖 子:1867
专家分:0
注 册:2008-5-3
收藏
得分:0 
学习了
刚到二维数组

爱上你 是 我的错  可是离 开  又舍不得  听着你为我写的歌     好难过
如果说 我说如果  我们还 能  重新来过   不去计 较 谁对谁错  会怎么做
2008-05-05 22:39
yk19880525
Rank: 1
来 自:江汉大学
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-5-5
收藏
得分:0 
回复 2# 的帖子
不是不是    你斜着看   是按斜着的那个规律输出的
2008-05-05 22:44
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
#include <stdio.h>
int main()
{
int a[6][6]={1, 2, 6, 7,15,16,3, 5, 8,14,17,26,4, 9,13,18,25,27,10,12,19,24,28,33,11,20,23,29,32,34,21,22,30,31,35,36};
int max=0;

for(int i=0;i<6;i++)
for(int j=0;j<6;j++)
   if(a[i][j]>max)
     max=a[i][j];

 int *b=new int[max];
 for( i=0;i<max;i++)
    b[i]=0;

 for( i=0;i<max;i++)
 b[a[i/6][i%6]]++;

 for(int j=0;j<max;j++)
  while(b[j]-->0)
    printf("%d ",j);
  
    return 0;
}

学习需要安静。。海盗要重新来过。。
2008-05-05 22:47
yk19880525
Rank: 1
来 自:江汉大学
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-5-5
收藏
得分:0 
怎么像不对啊!!
2008-05-05 22:55
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
你真的弄懂了吗?用c++编译..不要tc

学习需要安静。。海盗要重新来过。。
2008-05-05 22:56
yk19880525
Rank: 1
来 自:江汉大学
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-5-5
收藏
得分:0 
回复 5# 的帖子
--------------------Configuration: m - Win32 Debug--------------------
Compiling...
m.c
c:\documents and settings\administrator\m.c(7) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(7) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(7) : error C2143: syntax error : missing ')' before 'type'
c:\documents and settings\administrator\m.c(7) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(7) : error C2065: 'i' : undeclared identifier
c:\documents and settings\administrator\m.c(7) : warning C4552: '<' : operator has no effect; expected operator with side-effect
c:\documents and settings\administrator\m.c(7) : error C2059: syntax error : ')'
c:\documents and settings\administrator\m.c(8) : error C2143: syntax error : missing ';' before 'for'
c:\documents and settings\administrator\m.c(8) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(8) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(8) : error C2143: syntax error : missing ')' before 'type'
c:\documents and settings\administrator\m.c(8) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(8) : error C2065: 'j' : undeclared identifier
c:\documents and settings\administrator\m.c(8) : warning C4552: '<' : operator has no effect; expected operator with side-effect
c:\documents and settings\administrator\m.c(8) : error C2059: syntax error : ')'
c:\documents and settings\administrator\m.c(9) : error C2143: syntax error : missing ';' before 'if'
c:\documents and settings\administrator\m.c(12) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(14) : error C2065: 'b' : undeclared identifier
c:\documents and settings\administrator\m.c(14) : error C2109: subscript requires array or pointer type
c:\documents and settings\administrator\m.c(14) : error C2106: '=' : left operand must be l-value
c:\documents and settings\administrator\m.c(17) : error C2109: subscript requires array or pointer type
c:\documents and settings\administrator\m.c(17) : error C2105: '++' needs l-value
c:\documents and settings\administrator\m.c(19) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(19) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(19) : error C2143: syntax error : missing ')' before 'type'
c:\documents and settings\administrator\m.c(19) : error C2143: syntax error : missing ';' before 'type'
c:\documents and settings\administrator\m.c(19) : warning C4552: '<' : operator has no effect; expected operator with side-effect
c:\documents and settings\administrator\m.c(19) : error C2059: syntax error : ')'
c:\documents and settings\administrator\m.c(20) : error C2143: syntax error : missing ';' before 'while'
c:\documents and settings\administrator\m.c(20) : error C2109: subscript requires array or pointer type
c:\documents and settings\administrator\m.c(20) : error C2105: '--' needs l-value
Error executing cl.exe.

m.obj - 28 error(s), 3 warning(s)
2008-05-05 23:02
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
文件扩展名字改成.cpp

学习需要安静。。海盗要重新来过。。
2008-05-05 23:04
yk19880525
Rank: 1
来 自:江汉大学
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-5-5
收藏
得分:0 
回复 9# 的帖子
我qq308612639   我还有东西想问你一下
2008-05-05 23:09
快速回复:难题 求高手帮忙
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015648 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved