Discover answers to your questions with Westonci.ca, the leading Q&A platform that connects you with knowledgeable experts. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

Question: In a letter to the editor of CACM, Rubin (1987) uses the following code segment as evidence that the readability of some code with gotos is better than the equivalent code without gotos. This code finds the first row of an n by n integer matrix named x that has nothing but zero values.
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++)
if (x[i][j] != 0)
goto reject;
println ('First all-zero row is:', i);
break;
reject:
}
Rewrite this code without gotos in one of the following languages: C, C++, Java, or C#. Compare the readability of your code to that of the example code

For Help: https://www.chegg.com/homework-help/questions-and-answers/5-letter-editor-cacm-rubin-1987-uses-following-code-segment-evidence-readability-code-goto-q9138435
https://www.chegg.com/homework-help/questions-and-answers/letter-editor-cacm-rubin-1987-uses-following-code-segment-evidence-readability-code-gotos--q49180398


Sagot :

Answer:

C++

for (i = 1; i <= n; i++) {

flag = 1;

for (j = 1; j <= n; j++)

if (x[i][j] <> 0) {

flag = 0;

break;

}

if (flag == 1) {

printf ("First all zero row is: %d\n", i);

break;

}

}

Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.