fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. // Define the steps and substeps
  7. vector<string> steps = {"Step 1", "Step 2", "Step 3", "Step 4"};
  8. vector<string> substeps = {"Substep 1", "Substep 2", "Substep 3", "Substep 4"};
  9.  
  10. // Create a function to stitch the steps and substeps together
  11. void stitch(vector<string>& steps, vector<string>& substeps) {
  12. // Iterate through the steps
  13. for (string step : steps) {
  14. // Iterate through the substeps
  15. for (string substep : substeps) {
  16. // Stitch the step and substep together
  17. steps.push_back(step + " " + substep);
  18. }
  19. }
  20. }
  21.  
  22. // Create a main function
  23. int main() {
  24. // Stitch the steps and substeps together
  25. stitch(steps, substeps);
  26.  
  27. // Print the steps
  28. for (string step : steps) {
  29. cout << step << endl;
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
Step 1
Step 2
Step 3
Step 4
Step 1 Substep 1
Step 1 Substep 2
Step 1 Substep 3
Step 1 Substep 4
 Substep 1
 Substep 2
 Substep 3
 Substep 4
 Substep 1
 Substep 2
 Substep 3
 Substep 4
 Substep 1
 Substep 2
 Substep 3
 Substep 4