Fill Arrays
As you remember, by accessing elements of the array, we can not only print them but also change them. For instance:
12345678int x[2][3] { {1, 2, 3}, {4, 5, 6} }; cout << x[0][0] << endl; x[0][0] = 100; cout << x[0][0];
Actually, we may not only change elements of the existing array but also set values:
12345678910111213int x[2][2]; x[0][0] = 1; cout << x[0][0] << " "; x[1][0] = 2; cout << x[1][0] << " "; x[0][1] = 3; cout << x[0][1] << " "; x[1][1] = 4; cout << x[1][1] << " ";
Let's consolidate the acquired knowledge!
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 7
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Suggested prompts:
Spørg mig spørgsmål om dette emne
Opsummér dette kapitel
Vis virkelige eksempler
Awesome!
Completion rate improved to 2.94
Fill Arrays
Stryg for at vise menuen
As you remember, by accessing elements of the array, we can not only print them but also change them. For instance:
12345678int x[2][3] { {1, 2, 3}, {4, 5, 6} }; cout << x[0][0] << endl; x[0][0] = 100; cout << x[0][0];
Actually, we may not only change elements of the existing array but also set values:
12345678910111213int x[2][2]; x[0][0] = 1; cout << x[0][0] << " "; x[1][0] = 2; cout << x[1][0] << " "; x[0][1] = 3; cout << x[0][1] << " "; x[1][1] = 4; cout << x[1][1] << " ";
Let's consolidate the acquired knowledge!
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 7