homework

Hello!

I have to write a program that outputs a text vertically.
I have a print_all function specified and may not change this.

The issue must look like this:
Inhalt von Name:
Buchstabe 1: M
Buchstabe 2: a
Buchstabe 3: x
Buchstabe 4:
Buchstabe 5: M
Buchstabe 6: u
Buchstabe 7: s
Buchstabe 8: t
Buchstabe 9: e
Buchstabe 10: r
Buchstabe 11: m
Buchstabe 12: a
Buchstabe 13: n
Buchstabe 14: n

This is the print_all function:
/*
* print_all.h print_all prints a Container
*/

#ifndef PRINT_ALL_H
#define PRINT_ALL_H

#include <iostream>
#include <cstdlib>

template<typename Container, typename Head, typename Tail, typename Sep>
void print_all(std::ostream& out, const Container& v,
const Head& head, const Tail& tail, const Sep& sep)
{
out << head;
for (auto& x: v) {
out << x;
if (&x != &v.back())
out << sep;
}
out << tail;
}

#endif
What actually is your problem ?
To see how the print_all function works call it from main with a string "Max Mustermann".
Topic archived. No new replies allowed.