#include<iostream>
using namespace std;
main() {
string my_str = "Hello World";
for(int i = 0; i<my_str.length(); i++) {
cout << my_str.at(i) << endl; //get character at position i
}
}
#include <iostream>
int main()
{
std::string str = "Hello World";
for(int i = 0; i < str.size(); i++)
{
std::cout << i << ". " << str.at(i) << std::endl;
}
return 0;
}
void print(const std::string &s)
{
for (std::string::size_type i = 0; i < s.size(); i++) {
std::cout << s[i] << ' ';
}
}
char *myStrings[] = {"This is string 1", "This is string 2", "This is string 3",
"This is string 4", "This is string 5", "This is string 6"
};
void setup() {
Serial.begin(9600);
}
void loop() {
for (int i = 0; i < 6; i++) {
Serial.println(myStrings[i]);
delay(500);
}
}