Home > Back-end >  C use iterator
C use iterator

Time:11-10



 
#include
#include
using namespace std;

Int main ()
{
Int a [10]=,2,3,4,5,6,7,8,9,10 {1};
Vector Val (a, a + 10);
Auto it=val. The begin ();
For (; It!=val. The end (); It++)
It=* * it * 2;
Cout & lt; <* it & lt; }


Results:

CodePudding user response:

For (; It!=val. The end (); It++)
It=* * it * 2;
Cout & lt; <* it & lt; CodePudding user response:

For (; It!=val. The end (); It++)
It=* * it * 2;
Cout & lt; <* it & lt; This a mistake, need braces {} the two sentences on the enclosed in
 
For (; It!=val. The end (); It++)
{
It=* * it * 2;
Cout & lt; <* it & lt; }
  • Related