#include <iostream>
#include <windows.h>
#include <string>
usingnamespace std;
void main()
{
//Printing on screen
longlong R = 0, G = 0, B = 0;
int Repeat = 1, xy = 10;
HDC dc;
dc=GetDC(0);
HBRUSH dr;
string sRepeat;
sRepeat = "open";
while(Repeat==1 || sRepeat = "open")
{
cout << "Choose value of R: ";
cin >> R;
cout << "Choose value of G: ";
cin >> G;
cout << "Choose the value of B: ";
cin >> B;
dr=CreateSolidBrush(RGB(R,G,B));
SelectObject(dc,dr);
Rectangle(dc,xy,xy,500,500);
cout << "Would you like to print another one? 1 for yes and 0 for no: ";
cin >> Repeat;
cin >> sRepeat;
if(Repeat == 0)
{
sRepeat = "close";
}
elseif(Repeat == 1)
{
sRepeat = "open";
}
xy += 10;
}
if(Repeat == 0 || sRepeat = "close")
{
DeleteObject(dr);
ReleaseDC(0,dc);
cout << "Press anything to exit";
cin.get()
}
Please help, I'm doing the string because whenever the input for the int is a letter, it glitches and prints boxes on the screen continuously with the previous colour