W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

Snehil Khanor's Binary Log

Write a program to find Difference of two matrix


Two matrix are taken from user.. Substraction matrix is displayed as output..
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int a[10][10],b[10][10],c[10][10],m,n,i,j;
  7. cout<<"Enter number of rows: ";
  8. cin>>m;
  9. cout<<"Enter number of coloumns: ";
  10. cin>>n;
  11. cout<<endl<<"Enter elements of matrix A: "<<endl;
  12. //Coding by: Snehil Khanor
  13. //http://WapCPP.blogspot.com
  14. for(i=0;i<m;i++)
  15. {
  16. for(j=0;j<n;j++)
  17. {
  18. cout<<"Enter element a"<<i+1<<j+1<<": ";
  19. cin>>a[i][j];
  20. }
  21. }
  22. cout<<endl<<"Enter elements of matrix B: "<<endl;
  23. for(i=0;i<m;i++)
  24. {
  25. for(j=0;j<n;j++)
  26. {
  27. cout<<"Enter element b"<<i+1<<j+1<<": ";
  28. cin>>b[i][j];
  29. }
  30. }
  31. //Coding by: Snehil Khanor
  32. //http://WapCPP.blogspot.com
  33. cout<<endl<<"Displaying Matrix A: "<<endl<<endl;
  34. for(i=0;i<m;i++)
  35. {
  36. for(j=0;j<n;j++)
  37. {
  38. cout<<a[i][j]<<" ";
  39. }
  40. cout<<endl<<endl;
  41. }
  42. cout<<endl<<"Displaying Matrix B: "<<endl<<endl;
  43. for(i=0;i<m;i++)
  44. {
  45. for(j=0;j<n;j++)
  46. {
  47. cout<<b[i][j]<<" ";
  48. }
  49. cout<<endl<<endl;
  50. }
  51. cout<<endl<<"Matrix A - Matrix B = Matrix C: "<<endl<<endl;
  52. for(i=0;i<m;i++)
  53. {
  54. for(j=0;j<n;j++)
  55. {
  56. cout<<a[i][j]-b[i][j]<<" ";
  57. }
  58. cout<<endl<<endl;
  59. }
  60. getch();
  61. }

1 comments:

Satish kumar August 30, 2013 at 12:39 PM  

I MAKE A GOOD PROGRAM IN C++ AND THIS PRGRAM IS SHORT AND ESAY

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log

Blog Archive



eXTReMe Tracker