LAB7_1020

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; const int n = 6 ; int main() { int a[n][n]; for (size_t i = 0 ; i < n ; i++){ for (size_t j = 0 ; j< n ; j++){ a[i][j] = 6 - rand( ) % 10 ; if (a[i][j] >= 0 ) cout << " " << a[i][j] << " " ; else cout << a[i][j] << " " ; } cout << endl ; } int k = 0 ; //bool sign = true ; for (size_t i = 0 ; i < n ; i++){ for (size_t j = 0 ; j< n ; j++){ if ((( a[i][j] >= 0 ) && ( a[i+1][j+1] < 0 )) or (( a[i][j] < 0 ) && ( a[i+1][j+1] >= 0 ))){ //sign = false ; k++; } else continue ; } } cout << " Количество смены знаков = " << k << endl ; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines