#help w a project

2 messages · Page 1 of 1 (latest)

blazing anchor
#

the inner loop shouldn't be based on the range but on the actual value of the characters

#
#include <iostream>
#include <string>

int main(){

    std::string user_input {};
    std::cout << "Enter something: ";
    std::getline(std::cin, user_input);

    for(size_t i {0}; i < user_input.length(); ++i){

        std::string_view const slice {user_input.c_str(), i};

        for(char c {'a'}; c <= user_input[i]; ++c){
            std::cout << slice << c;
            std::cout << '\n';
        }
    }

    return 0;
}