-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrays_9.cpp
38 lines (34 loc) · 972 Bytes
/
arrays_9.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Transpose of a 1DMatrix
#include <iostream>
using namespace std;
int main()
{
int size;
cout << "Enter size of the Column Vector" << endl;
cin >> size;
int cvarr[size];
int transposed[size];
cout << "Enter elements in Row Vector" << endl;
for (int i = 0; i < size; i++)
{
cout << "Enter " << i << " th elements of cvarr[" << i << "]: ";
cin >> cvarr[i];
}
cout<< "Row Vector Representation of Matrix B :(1 x m) Column Matrix" << endl;
cout<<"[";
for (int i = 0; i < size; i++)
{
cout << cvarr[i]<< " ";
}
cout<<"]"<< endl;
cout <<"Transpose of a Row Matrix is Column Matrix(m x 1)" << endl;
for (int i = 0; i < size; i++)
{
cout << "| ";
transposed[i] = cvarr[i];
cout << transposed[i] <<" ";
cout << " |";
cout << "\n";
}
return 0;
}