The document discusses various operations that can be performed on matrices in C++ including reading and displaying a matrix, calculating the sum of elements in each row of a matrix, and sorting and modifying vectors through operations like deletion of an element. Code examples are provided for reading, writing, sorting, and modifying matrices and vectors through operations like calculating row sums and deleting elements.
The document discusses various operations that can be performed on matrices in C++ including reading and displaying a matrix, calculating the sum of elements in each row of a matrix, and sorting and modifying vectors through operations like deletion of an element. Code examples are provided for reading, writing, sorting, and modifying matrices and vectors through operations like calculating row sums and deleting elements.
The document discusses various operations that can be performed on matrices in C++ including reading and displaying a matrix, calculating the sum of elements in each row of a matrix, and sorting and modifying vectors through operations like deletion of an element. Code examples are provided for reading, writing, sorting, and modifying matrices and vectors through operations like calculating row sums and deleting elements.
#include<iostream> int a[100][100],n,m; using namespace std; int main() { int i,j; cin>>n>>m; for(i=1;i<=n;i++) for(j=1;j<=m;j++) cin>>a[i][j]; return 0; }
a) Suma elementelor de pe fiecare linie #include<iostream> int a[100][100],n,m; using namespace std; int main() { int i,j,S; cin>>n>>m; for(i=1;i<=n;i++) for(j=1;j<=m;j++) cin>>a[i][j]; for(i=1;i<=n;i++) for(j=1;j<=m;j++) {for(i=1;i<=n;i++) { S=0; for(j=1;j<=m;j++) S+=a[i][j]; } cout<<S; } Sortarea unui vector (metoda directa): #include <iostream> int a[100],n; using namespace std;
int main() { int j,aux,i; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<n;i++) {for(j=i+1;j<=n;j++) if(a[i]>a[j]) { aux=a[i]; a[i]=a[j]; a[j]=aux; } } for(i=1;i<=n;i++) { cout<<a[i]<<" "; } return 0; } Stergerea unui element dintr-un vector(care se citeste): #include <iostream> int a[100],n,i,k; using namespace std;
Learn Python Programming for Beginners: Best Step-by-Step Guide for Coding with Python, Great for Kids and Adults. Includes Practical Exercises on Data Analysis, Machine Learning and More.
Microsoft 365 Guide to Success: 10 Books in 1 | Kick-start Your Career Learning the Key Information to Master Your Microsoft Office Files to Optimize Your Tasks & Surprise Your Colleagues | Access, Excel, OneDrive, Outlook, PowerPoint, Word, Teams, etc.
Microsoft PowerPoint Guide for Success: Learn in a Guided Way to Create, Edit & Format Your Presentations Documents to Visual Explain Your Projects & Surprise Your Bosses And Colleagues | Big Four Consulting Firms Method
Microsoft Excel Guide for Success: Transform Your Work with Microsoft Excel, Unleash Formulas, Functions, and Charts to Optimize Tasks and Surpass Expectations [II EDITION]
Modern Tkinter for Busy Python Developers: Quickly Learn to Create Great Looking User Interfaces for Windows, Mac and Linux Using Python's Standard GUI Toolkit