Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
f0702.cpp
Package: c.rar [view]
Upload User: puke2000
Upload Date: 2022-07-25
Package Size: 912k
Code Size: 1k
Category:
CSharp
Development Platform:
Visual C++
- //=====================================
- // f0702.cpp
- // 消去全局数据
- //=====================================
- #include<iostream>
- #include<iomanip>
- #include<fstream>
- #include<vector>
- using namespace std;
- //-------------------------------------
- typedef vector<vector<int> > Mat;
- Mat input();
- Mat transpose(const Mat& a);
- void print(const Mat& a);
- //-------------------------------------
- int main(){
- print(transpose(input()));
- }//------------------------------------
- Mat input(){
- ifstream in("a.txt");
- int row, col;
- in>>row>>col;
- Mat a(row, vector<int>(col));
- for(int i=0; i<row; ++i)
- for(int j=0; j<col; ++j)
- in>>a[i][j];
- return a;
- }//------------------------------------
- Mat transpose(const Mat& a){
- Mat b(a[0].size(), vector<int>(a.size()));
- for(int i=0; i<a.size(); ++i)
- for(int j=0; j<a[0].size(); ++j)
- b[j][i] = a[i][j];
- return b;
- }//------------------------------------
- void print(const Mat& a){
- for(int i=0; i<a.size(); ++i){
- for(int j=0; j<a[0].size(); ++j)
- cout<<setw(4)<<a[i][j];
- cout<<endl;
- }
- }//====================================