| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付买域名,送MP3、MP4
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY买空间,免费送域名(厦门中资源)
共有 256 人关注过本帖
标题:链表储存矩阵旋转90度输出 如何实现??
收藏  订阅  推荐  打印 
joker39
Rank: 2
等级:注册会员
威望:1
帖子:78
积分:926
注册:2007-9-6
链表储存矩阵旋转90度输出 如何实现??


程序代码:
#include <iostream>
using namespace std;
typedef struct LinkNode
{
        int x;
        int y;
        int data;
        LinkNode* next;
}Node;

int main()
{
    int m;
    int n;
    int data;
    Node * head=new Node;
    Node * p=new Node;
    head->next=p;      
    cout<<"输入行号和列号"<<endl;
    cin>>m>>n;
    for(int i=0; i<m; i++)
       for(int j=0; j<n; j++)
       {
           cin>>data;
           p->x=i;
           p->y=j;
           p->data=data;
           p->next=new Node;
           p=p->next;
       }   
     p=NULL;
     
     p=head->next;
     while(p->next){
        cout<<p->data<<" ";
        if(p->y==n-1) cout<<endl;
        p=p->next;
     }
     cout<<endl;
     system("pause");
     return 0;
}
矩阵我已经建立好了,就差一个旋转的算法。。。高手帮忙啊
搜索更多相关主题的帖子: 链表  矩阵  储存  输出  
2008-9-14 22:10
zjl138
Rank: 4
等级:高级会员
威望:1
帖子:773
积分:9164
注册:2007-11-12

矩阵旋转90度

//先将矩阵转置,再依次将各列首尾互换.

i like linux...
2008-9-14 23:02
zjl138
Rank: 4
等级:高级会员
威望:1
帖子:773
积分:9164
注册:2007-11-12

abc      ail      lia
ijk  --->bjm----->mjb
lmn      ckn      nkc

i like linux...
2008-9-14 23:04
joker39
Rank: 2
等级:注册会员
威望:1
帖子:78
积分:926
注册:2007-9-6

晕  这样说我还是不懂  因为链表比较不一样啊
2008-9-15 23:57
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.057319 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved