Adding characters to a string from cmd line

Hey, I'm trying to start a code for a Viginiere cipher and I need help with my string. I've created two strings, one for the encoded message and one for the code key. Both the encoded message and key are inputted in the command line. I need to keep adding characters to the key string until it is the same length as the encoded message. I'm using a for loop to make sure the key never gets larger than the message, but I can't seem to add the characters to the string. Any advice?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int main(int argc, char* argv[])
{
    string Secret = argv[1];
    string key = argv[2];
    for (unsigned long ii=key.size(); ii<Secret.size(); ++ii)
    {
        key.push_back('argv[2]');
    }
    cout <<key<< endl;
    
    return 0;
}
I need to keep adding characters to the key string until it is the same length as the encoded message.
What characters?

Let's assume you want to repeat characters from the key itself you might do this:
1
2
3
4
        for (unsigned long ii=0; key.size() < Secret.size(); ++ii)
    {
        key += key[ii];
    }
Topic archived. No new replies allowed.