Lesson 8
Arrays and Strings
Arrays store multiple values of the same type, while strings store text. Both are essential for practical programming.
Array Example
Example
#include <iostream>
using namespace std;
int main()
{
int numbers[5] = {10, 20, 30, 40, 50};
for (int i = 0; i < 5; i++)
{
cout << numbers[i] << endl;
}
return 0;
}String Example
Example
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name = "Alice";
cout << "Name: " << name << endl;
return 0;
}Book Tip:
This short lesson is part of a larger learning path. The full book expands each topic with more explanation, exercises, and projects.