Quick actions

cmd+k|ctrl+k

Navigation

Languages

Самостоятельная работа №7 Задание 4

Snippet info

Language

Cpp

Visibility

public

Author

dimonkoko1

Created

2018-11-25T12:02:06Z

Updated

2018-11-25T12:02:06Z

#include <iostream>
#include <iomanip>
using namespace std;
 
int main()
{   ////////////////////////////////////////////////Задание №4 Вариант 1017 //////////////////////////////////////////////////////////////
    const int M = 5; //строки
    const int N = 5;
    int i, j;
    int arr[M][N] = { { 1, -3,  5, -6,  3},
                      { 1, -7, -3, -2,  1}, 
                      { 4, -5,  6, -2,  3}, 
                      {-3, -5, -6, -7, -8}, 
                      { 1,  4,  6,  7,  3} };
 
    for(int i = 0; i < M;i++){
        for(int j = 0; j < N;j++){
            cout << setw(4) <<arr[i][j];
        }
        cout << endl;
    }
 
 
    for( int i = 0; i < M; i++ )
    {
        for( j = 0; ( arr[ i ][ j ] * arr[ i ][ j + 1 ] < 0 )&&( j < N - 1 ); j++ );
        if( j == N - 1 )
        {
            cout << "Знаки чередуются в " << i + 1 << " строке" << endl;
        }
    }
 
    
    return 0;
}
INFO