小编use*_*258的帖子

将TCHAR转换为char*以用于strstr函数

    char skype[6] = "Skype";
    HWND firstwindow = FindWindowEx(NULL, NULL, NULL, NULL);
    HWND window = firstwindow;
    TCHAR windowtext[MAX_PATH]; //search term

    //We need to get the console title in case we
    //accidentally match the search word with it
    //instead of the intended target window.
    TCHAR consoletitle[MAX_PATH];
    GetConsoleTitle(consoletitle, MAX_PATH);

    while(true){
        //Check window title for a match
        GetWindowText(window, windowtext, MAX_PATH);
        if (strstr(windowtext, skype)!=NULL && strcmp(windowtext, consoletitle)!=0) break; //search for program
            //Get next window
            window = FindWindowEx(NULL, window, NULL, NULL);
        if(window == NULL || window …
Run Code Online (Sandbox Code Playgroud)

c c++ qt

0
推荐指数
1
解决办法
1631
查看次数

当我尝试使用递归时,我的C++程序不起作用了什么?


我需要以下c ++代码的帮助,尝试continue在程序的末尾添加一个,以便它为矩形创建用户指定的维度,并要求用户重新重做该程序.

在程序的最后部分编译并运行它没有愚蠢的if和else语句,并且它可以工作.但随着continue/递归,它失败了.LOLZ.我= noob.


int main()
{


    int height, width, tmp, tmp2;

    char continue;

    cout << "Please Enter The Height Of A Rectangle (whole numbers only): ";
height:
    cin >> height;
    if(height<1)
    {
        cout << "   Please Enter A Height Of Between 1 And 20: ";
        goto height;
    }
    cout << "Please Enter The Width Of A Rectangle  (whole numbers only): ";
width:
    cin >> width;
    if(width<1)
    {
        cout << "   Please Enter A Width Of …
Run Code Online (Sandbox Code Playgroud)

c++ recursion continue

-2
推荐指数
2
解决办法
201
查看次数

标签 统计

c++ ×2

c ×1

continue ×1

qt ×1

recursion ×1