Here is the programm:
#include <iostream>
#include <string>
using namespace std;
string add(string s, int n) {
 switch (n%3) {
 case 2: s = s + "A";
 case 1: s = s + "B";
 break;
 default: s = s + "C";
 }
 return s;
}
int main() {
 string s{"X"};
 for (size_t i{0}; i < 6; ++i)
 s = add(s, i);
 cout << s;
 return 0;
}
And I expected output: XCBACBA
But correct output is:XCBABCBAB
Can you explain me an algorithm? it seems, that i don't understand the logic begind switch statement(and how does absence of break after case 2 influence on the result?)
 
     
     
    