Copying more than one variable continuously to clipboard

Hi! I'm new to both C++ and this website, and I haven't yet explored advanced C++; I've just learned the basics of it, or at least I think they're sufficient, to get started. I just wanted to ask how I can copy

"\nResult: {\"" << word << "\", \"" << meaning << "\", \"" << person << "\", \"" << place << "\", \"" << age << "\", \"" << audioLink << "\"}" << addComma

to clipboard (This is actually a tool I'm creating for easily making nested array elements for insertion in another C++ file.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>

using namespace std; // I do know that this is considered bad practice though

int main() {
    string word;
    cout << "Enter word: ";
    getline(cin, word);

    string meaning;
    cout << "Enter meaning of word: ";
    getline(cin, meaning);

    string person;
    cout << "Enter person's name: ";
    getline(cin, person);

    string place;
    cout << "Enter person's current residence: ";
    getline(cin, place);

    int age;
    cout << "Enter person's age: ";
    cin >> age;

    string audioLink;
    cout << "Enter audio link: ";
    getline(cin, audioLink);

    char yesNo;
    cout << "Add comma after array element? Y/N: ";
    cin >> yesNo;

    char addComma;
    if(yesNo == 'Y') {
        addComma = ',';
    } else if(yesNo == 'N') {
        addComma = ' ';
    }

    cout << "\nResult: {\"" << word << "\", \"" << meaning << "\", \"" << person << "\", \"" << place << "\", \"" << age << "\", \"" << audioLink << "\"}" << addComma << endl; // I wanted to copy this to clipboard

    return 0;
}
Registered users can post here. Sign in or register to post.