How to input values of the matrix from keyboard in python
Pramod
pramo4d at gmail.com
Wed Aug 11 14:43:46 EDT 2010
Hi
I want to know the how we input values into the matrix (N*N size)
from keyboard in python,
Here I wrote Matrix programe in C++
This asks values from key board and print on the console N*N matrix ;
Thanks in advance ....
#include<iostream>
using namespace std;
int main()
{
double **a;
int i,j,n;
cout<<"Enter size of the matrix\n";
cin>>n;
for(i=0;i<n;i++){
for(j=0;j<n;j++)
a[i][j] = random();
//or
//cin>>a[i][j];
cout<<endl;
}
for(i=0;i<n;i++){
for(j=0;j<n;j++)
cout<<a[i][j]<<"\t";
cout<<endl;
}
delete [] a;
}
More information about the Python-list
mailing list