Skip to content

Instantly share code, notes, and snippets.

@theKlanc
Created July 3, 2017 15:37
Show Gist options
  • Save theKlanc/dc626ae187fde74233cbbae3103edffd to your computer and use it in GitHub Desktop.
Save theKlanc/dc626ae187fde74233cbbae3103edffd to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <cctype>
#include <Windows.h>
using namespace std;
void toClipboard(const std::string &s) {
OpenClipboard(0);
EmptyClipboard();
HGLOBAL hg = GlobalAlloc(GMEM_MOVEABLE, s.size());
if (!hg) {
CloseClipboard();
return;
}
memcpy(GlobalLock(hg), s.c_str(), s.size());
GlobalUnlock(hg);
SetClipboardData(CF_TEXT, hg);
CloseClipboard();
GlobalFree(hg);
}
int main()
{
while (true) {
cout << "ENTRA INPUT:";
string input, aesthetic;
getline(cin, input);
for (int i = 0; i < input.length(); ++i)
{
aesthetic += std::toupper(input[i]);
aesthetic += " ";
}
aesthetic += '\n';
for (int i = 1; i < input.length(); ++i)
{
if (input[i] == ' ')
{
aesthetic += '\n';
}
else
{
aesthetic += (char)toupper(input[i]);
aesthetic += '\n';
}
}
toClipboard(aesthetic);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment