Home > Back-end >  Who can help me to look at the C plus plus problem this not the first question above how to write
Who can help me to look at the C plus plus problem this not the first question above how to write

Time:10-11

Our teacher is really a long story, just call our own reading, don't explain to us...

CodePudding user response:

S++ that last sentence has a problem

CodePudding user response:

Learn to debug, press f11, f10

CodePudding user response:

S=& amp; B [0];
For (I=0; i <3; I++)
{
K=0;
For (j=0; j <3; J++)
{
K=k + a, [I] [j].
}
B [I]=k;
cout <* s & lt; + + s.
}


If you want to use a pointer, must first determine the pointer is valid, your s no assignment, pointing to the region is unknown, is an invalid pointer, so b * s=[I] this would be an error

CodePudding user response:

reference qq_41423086 reply: 3/f
s=& amp; B [0];
For (I=0; i <3; I++)
{
K=0;
For (j=0; j <3; J++)
{
K=k + a, [I] [j].
}
B [I]=k;
cout <* s & lt; + + s.
}


If you want to use a pointer, must first determine the pointer is valid, your s no assignment, pointing to the region is unknown, is an invalid pointer, so b * s=[I] this would be an error

Ok thank you

CodePudding user response:

University, is not a primary school, teaching way is this, only speak theory and method, and the rest are self-taught
You leave so much for your self-study time when the university is to let you play the game?
Is let your self-study, self-study ability is the first university to learn the ability of
If not university, also want to master this ability as soon as possible

This want to write some code, think well, specific code you more
There are two things, can consult:

A, array pointer and pointer array is not a concept
Int (* p) [3]. This is the pointer to a one-dimensional array
P=a, [0]. This is legal assignment, a [0], a [1], [2] is also a pointer to an array of

Int * p [3]; This is an array, the array element is of type int *
Such a definition p
P [0]=[0] this is a wrong, type mismatch

Two, two dimensional array can be as a one-dimensional array to use
Int a [3] [3].
Int * p=& amp; A [0] [0]; The p can p [0] ~ [9] p access all of the contents of the two-dimensional array
For example, initialization, you might write
For (I=0; I<9. I++)
* p++=rand () % 100;

Calculation of the first column and
Int s=0;
Fot (I=0; i<3; I++) s +=* p, p +=3;//p +=3 is to position the next column

Their study also quite good, in the bug inside looking for sorting,

CodePudding user response:

Fun
reference 5 floor response: ,
university is not a primary school, teaching way is this, only speak theory and method, and the rest are self-taught
You leave so much for your self-study time when the university is to let you play the game?
Is let your self-study, self-study ability is the first university to learn the ability of
If not university, also want to master this ability as soon as possible

This want to write some code, think well, specific code you more
There are two things, can consult:

A, array pointer and pointer array is not a concept
Int (* p) [3]. This is the pointer to a one-dimensional array
P=a, [0]. This is legal assignment, a [0], a [1], [2] is also a pointer to an array of

Int * p [3]; This is an array, the array element is of type int *
Such a definition p
P [0]=[0] this is a wrong, type mismatch

Two, two dimensional array can be as a one-dimensional array to use
Int a [3] [3].
Int * p=& amp; A [0] [0]; The p can p [0] ~ [9] p access all of the contents of the two-dimensional array
For example, initialization, you might write
For (I=0; I<9. I++)
* p++=rand () % 100;

Calculation of the first column and
Int s=0;
Fot (I=0; i<3; I++) s +=* p, p +=3;//p +=3 is to position the next column

Their study also quite good, in the bug inside looking for finishing,

I think you're right, but our teacher can't even speak principle of qing dynasty and is now online, I also read in their thinking, get 2 or...

CodePudding user response:

Fun
reference 5 floor response: ,
university is not a primary school, teaching way is this, only speak theory and method, and the rest are self-taught
You leave so much for your self-study time when the university is to let you play the game?
Is let your self-study, self-study ability is the first university to learn the ability of
If not university, also want to master this ability as soon as possible

This want to write some code, think well, specific code you more
There are two things, can consult:

A, array pointer and pointer array is not a concept
Int (* p) [3]. This is the pointer to a one-dimensional array
P=a, [0]. This is legal assignment, a [0], a [1], [2] is also a pointer to an array of

Int * p [3]; This is an array, the array element is of type int *
Such a definition p
P [0]=[0] this is a wrong, type mismatch

Two, two dimensional array can be as a one-dimensional array to use
Int a [3] [3].
Int * p=& amp; A [0] [0]; The p can p [0] ~ [9] p access all of the contents of the two-dimensional array
For example, initialization, you might write
For (I=0; I<9. I++)
* p++=rand () % 100;

Calculation of the first column and
Int s=0;
Fot (I=0; i<3; I++) s +=* p, p +=3;//p +=3 is to position the next column

Their study also quite good, in the bug inside looking for finishing,

Thank you for your guidance.

CodePudding user response:

Cramming education and the transition of the autonomous learning in college is a threshold, for some people to simple, difficult for some people,
Studies is a simple matter, use is a difficult thing, the teacher taught the former not taught the latter, so you will be confused and lose interest, self liberation,
Can be asked to posts, I think is have a thirst for knowledge, at least you have a tool, although it's not essential, the school asked the teacher, ask leadership work, they are the best tools,
I answer:
The integer 3 x3 policy, a two dimensional array of type int and assignment is required, or behind meaningless, mainly for the two-dimensional array traversal,
1, the output policy, cycle of two-dimensional array output, nested loop,
2, summation, horizontal lines, vertical column, as well as the output loop corresponding row or column to calculate additive,
3, the maximum, circulation is row or column value,
Two, pointer array, sorting, Pointers and traversal sequence
Understand what pointer array, storage array pointer, which correspond to the pointer to the corresponding character of two-dimensional arrays, sorting is the first letter in each row of a two-dimensional array size sorting pointer array,
Three, pointer function
Need to know what is a function pointer, function to participate in the transformation algorithm,
  • Related