Программа написана на с++. объяснить каждую строчку понятным языком

int main() {

SetConsoleCP (1251);

SetConsoleOutputCP (1251);


char matrix[13][18];

int max_line = 0, max_val = 0;


for(int i=0; i<13; i++){

cout << i+1 << ": ";

int line_cnt = 0;

for(int a=0; a<18; a++){

matrix[i][a] = rand()%('z'-'a')+'a';

cout << matrix[i][a] << ' ';

if((a>0) && (matrix[i][a]!=matrix[i][a-1])) line_cnt++;

}

cout << " = " << line_cnt << endl;

if(max_val <= line_cnt){

max_val = line_cnt;

max_line = i;

}

}

cout << endl << "Номер ряда с наибольшим кол-вом = " << max_line+1;




cout << endl << endl << endl;

system ("pause");

return 0;

}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.