EDN Admin
Well-known member
my questions are following:
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Part 1
<p style="line-height:normal <span style="font-size:10pt; font-family:"Times New Roman","serif" a)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Start by writing a single function that will have as input (through parameters): a single two-dimensional array that is 80 rows by 80 columns; an integer, R, indicating
the number of rows that are being used in the array; and an integer, C, indicating the number of columns that are being used in the array.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" This function has no return value.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" This function will print out R rows and C columns of the two-dimensional array to the console. Each row will be on a line by itself; so, you should print out an
endline after each row.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" You may call this function whatever you wish, but must identify in a comment that the function is for part 1.
<p style="line-height:normal <span style="font-size:10pt; font-family:"Times New Roman","serif" b)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Create a second function called "testing" that has no input and no return value. You will be using this function to test part 1, and all other parts of this question.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" In the body of this function you should declare a single two dimensional array of characters with 80 rows and 80 columns, and then initialize the array (using
nested loops) so that the element at row r and column c contains the character described by the following expression:<span style="font-size:12pt; font-family:"Courier New" a + ((r+c)%26)<span style="font-size:12pt; font-family:"Times New Roman","serif" .
(Yes, this is a valid C expression for a character!)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" After your array has been declared and initialized, you are to write a couple of function calls to your function from (a) to print out parts of the array; you
will find it easier to read the console output of your program if you print a newline between each function call. For example, if you call your function with values of 5 and 10 for R and C, respectively, then your program will print out:
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" abcdefghij
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" bcdefghijk
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" cdefghijkl
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" defghijklm
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" efghijklmn
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" I did the part-1, but not sure, right/wrong?
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New"
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; //Part 1 of question-1
<span style="color:Blue; void Normal_Print( <span style="color:Blue; int ascii[80][80],<span style="color:Blue; int R,<span style="color:Blue; int C){
<span style="color:Blue; int MAXR = R;
<span style="color:Blue; int MAXC;
<span style="color:Blue; for (R = 0; R < MAXR; R++)
{
cout << endl;
<span style="color:Blue; for (C = 0; C < MAXC - 1; C++)
cout << ascii[R][C];
}
cout << endl;
}
<span style="color:Green; //part 2
<span style="color:Blue; void testing(){
<span style="color:Blue; int r;
<span style="color:Blue; int c;
<span style="color:Blue; int MAXR=80,MAXC=80;
<span style="color:Blue; char ascii[80][80] = {a + ((r+c)%26)};
<span style="color:Blue; for (r = 0; r < MAXR; r++)
{
cout << endl;
<span style="color:Blue; for (c = 0; c < MAXC - 1; c++)
ascii[r][c] = a+((r+c)%26);
}
cout << endl;
}
[/code]
<br/>
Please help me ASAP<br/>
View the full article
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Part 1
<p style="line-height:normal <span style="font-size:10pt; font-family:"Times New Roman","serif" a)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Start by writing a single function that will have as input (through parameters): a single two-dimensional array that is 80 rows by 80 columns; an integer, R, indicating
the number of rows that are being used in the array; and an integer, C, indicating the number of columns that are being used in the array.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" This function has no return value.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" This function will print out R rows and C columns of the two-dimensional array to the console. Each row will be on a line by itself; so, you should print out an
endline after each row.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" You may call this function whatever you wish, but must identify in a comment that the function is for part 1.
<p style="line-height:normal <span style="font-size:10pt; font-family:"Times New Roman","serif" b)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" Create a second function called "testing" that has no input and no return value. You will be using this function to test part 1, and all other parts of this question.
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" In the body of this function you should declare a single two dimensional array of characters with 80 rows and 80 columns, and then initialize the array (using
nested loops) so that the element at row r and column c contains the character described by the following expression:<span style="font-size:12pt; font-family:"Courier New" a + ((r+c)%26)<span style="font-size:12pt; font-family:"Times New Roman","serif" .
(Yes, this is a valid C expression for a character!)
<p style="line-height:normal <span style="font-size:12pt; font-family:"Times New Roman","serif" After your array has been declared and initialized, you are to write a couple of function calls to your function from (a) to print out parts of the array; you
will find it easier to read the console output of your program if you print a newline between each function call. For example, if you call your function with values of 5 and 10 for R and C, respectively, then your program will print out:
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" abcdefghij
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" bcdefghijk
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" cdefghijkl
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" defghijklm
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" efghijklmn
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New" I did the part-1, but not sure, right/wrong?
<p style="margin-bottom:0.0001pt; line-height:normal <span style="font-size:10pt; font-family:"Courier New"
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; //Part 1 of question-1
<span style="color:Blue; void Normal_Print( <span style="color:Blue; int ascii[80][80],<span style="color:Blue; int R,<span style="color:Blue; int C){
<span style="color:Blue; int MAXR = R;
<span style="color:Blue; int MAXC;
<span style="color:Blue; for (R = 0; R < MAXR; R++)
{
cout << endl;
<span style="color:Blue; for (C = 0; C < MAXC - 1; C++)
cout << ascii[R][C];
}
cout << endl;
}
<span style="color:Green; //part 2
<span style="color:Blue; void testing(){
<span style="color:Blue; int r;
<span style="color:Blue; int c;
<span style="color:Blue; int MAXR=80,MAXC=80;
<span style="color:Blue; char ascii[80][80] = {a + ((r+c)%26)};
<span style="color:Blue; for (r = 0; r < MAXR; r++)
{
cout << endl;
<span style="color:Blue; for (c = 0; c < MAXC - 1; c++)
ascii[r][c] = a+((r+c)%26);
}
cout << endl;
}
[/code]
<br/>
Please help me ASAP<br/>
View the full article