Created
July 3, 2017 15:37
-
-
Save theKlanc/dc626ae187fde74233cbbae3103edffd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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