//Now select File-> New in Notepad and type the C++ program
#include<iostream>
using namespace std;
intmain( )
{
int a[3][3], i, j;
for(i=o; j<3;i++)
{
for(j=0;j<3;j++)
{count<<“enter the value for array [”<<i + 1<<"] <<"<<"["<<j + 1 <<"]";
cin>>a[i][j];
}
}
system(“cls”); .
cout<<“\n \nOriginal Array\n”;
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
cout<<a[i] [j]
cout<<end1;
}
return 0;
}
// Save this file as trans_cpp.cpp
// Now select File → New in Notepad and type the Python program
#Save the File as transpose.py.Program that compiles and executes a .cpp file
#Python tanspose.py -i trans_cpp
import sys, os, getopt
def main(argv):
cpp_file ="
exefile = ”
opts, args = getopt.getopt(argv, “i:” ,[‘ifile= ’])
for o, a in opts:
if o in (“-i” ,–ifile”):
cpp_file =a+ ‘.cpp’
exe_file = a+ ‘.exe’
run(cpp_file, exe_file)
def run(cpp_file, exe file):
print(“Compiling” + cppfile)
os.system(‘g++’ + cpp_file + ‘-o ‘+ exe_file)
print(“Running” + exefile)
print(“.........")
print
os.system(exe_file)
print
if_name_== ’_main_’:
main(sys.argv[1:])
Output of the above program
Original Array
1 2 3
4 5 6
7 8 9
The Transpose of Matrix
1 4 7
2 5 8
3 6 9