Error?

I appear to get a strange error, it won't let me enter the second input. Could someone help me?

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
45
#include <iostream>
#include <string>
#include <windows.h>
#include <WinBase.h>
#include <stdio.h>
using namespace std;
int a,count = 0;
int size;
string ToKey;
bool Spam = false;
string Chars;
int i = 0;


void Sendkey(char Key1) {
	if (Key1==' ') {
		keybd_event(VkKeyScan(VK_SPACE),0x9d,0,0);
		keybd_event(VkKeyScan(VK_SPACE),0x9d,KEYEVENTF_KEYUP,0);}
	else {
	keybd_event(VkKeyScan(Key1),0x9d,0,0);
	keybd_event(VkKeyScan(Key1),0x9d,KEYEVENTF_KEYUP,0);}
}
int main() {
	cout << "Enter Text." <<endl;
	cin >> ToKey;
	auto size = ToKey.length();
	cout << "Put in  the word 'start' to activate it!" << endl;
	cin >> Chars;
	while(true) {

		if (Chars=="start") {
			if (Spam == false) {
			Spam = true;
			}
			}
		if (i==size) 
		{
			i = 0;
			keybd_event(VkKeyScan(VK_RETURN),0x9d,0,0);
	keybd_event(VkKeyScan(VK_RETURN),0x9d,KEYEVENTF_KEYUP,0);
			Sleep(100);}
	if (Spam) {Sendkey(ToKey[i]);}
	i++;}
	return 0;
	}
closed account (48T7M4Gy)
Best to seek help in the Windows programming forum by the look of it.
Topic archived. No new replies allowed.