#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int mas[5];
for(int i = 0; i < 5; i++){
cout << "Input element[" << i << "] = "; cin >> mas[i];
while(mas[i] < 0){
}
cout << "Show massiv" << endl;
cout << mas[i] << " ";
cout << "\nReversed massiv without zero(0)" << endl;
for(int i = 4; i >= 0; i--){
if(mas[i] != 0){
cout << endl;
system("pause");
return 0;
#include <vector>
typedef pair<int, int> rb;
int main() {
vector<rb> lst;
int n;
cout<<"n = "; cin>>n;
int a[n][n];
for (int i=0; i<n; i++) {
cout<<"row "<<i+1<<": ";
for (int j=0; j<n; j++) cin>>a[i][j];
cout<<"list of edges"<<endl;
for (int i=0; i<n; i++)
for (int j=i+1; j<n; j++)
if (a[i][j]>0) lst.push_back(make_pair(i+1,j+1));
for (int i=0; i<lst.size(); i++)
cout<<lst[i].first<<" "<<lst[i].second<<endl;
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int mas[5];
for(int i = 0; i < 5; i++){
cout << "Input element[" << i << "] = "; cin >> mas[i];
while(mas[i] < 0){
cout << "Input element[" << i << "] = "; cin >> mas[i];
}
}
cout << "Show massiv" << endl;
for(int i = 0; i < 5; i++){
cout << mas[i] << " ";
}
cout << "\nReversed massiv without zero(0)" << endl;
for(int i = 4; i >= 0; i--){
if(mas[i] != 0){
cout << mas[i] << " ";
}
}
cout << endl;
system("pause");
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> rb;
int main() {
vector<rb> lst;
int n;
cout<<"n = "; cin>>n;
int a[n][n];
for (int i=0; i<n; i++) {
cout<<"row "<<i+1<<": ";
for (int j=0; j<n; j++) cin>>a[i][j];
}
cout<<"list of edges"<<endl;
for (int i=0; i<n; i++)
for (int j=i+1; j<n; j++)
if (a[i][j]>0) lst.push_back(make_pair(i+1,j+1));
for (int i=0; i<lst.size(); i++)
cout<<lst[i].first<<" "<<lst[i].second<<endl;
system("pause");
return 0;
}