小编Pon*_*n-3的帖子

Mac 有 FindWindow() 替代品吗?

我正在将一个应用程序移植到 Mac OS X。它使用 FindWindow()。具体功能如下:

FindWindow(NULL,“我的应用程序”)

然而,这在 Mac 上不起作用。Mac OS X 是否有类似的功能,或者更好的是,是否有通用功能?

我试图通过功能在“应用程序的主窗口”中使用它。

c++ windows macos function

5
推荐指数
1
解决办法
2317
查看次数

编译时"发现一个或多个多重定义的符号"错误

在构建时我遇到了这些错误:

错误5错误LNK2005:"int __cdecl numGen(void)"(?numGen @@ YAHXZ)已在main.obj中定义错误6错误LNK1169:找到一个或多个多重定义的符号

numGen.cc:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int numGen()
{
    int rNum;
    srand(time(NULL)); //--Seeds a random number.
    rNum = 1 + (rand() % 100);

    return rNum;
}
Run Code Online (Sandbox Code Playgroud)

main.cc:

#include <iostream>
#include "NumGen.cc"

int main()
{
    std::cout << numGen();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++

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

我如何为这个页面设计thead和tbody的样式?

我有一个包含CSS的HTML页面.CSS适用于页面的某些部分,但不适用于我讨论的部分.我希望有一个背景颜色并进行一些其他样式更改,但它们没有实现.

这是CSS:

table.tablesorter thead tr, table.tablesorter thead tr th, table.tablesorter tfoot tr th { background-color: #e6EEEE; font-size: 8pt; padding: 4px; }
table.tablesorter thead tr .header { cursor: pointer; }
table.tablesorter tbody td { padding: 6px; vertical-align: top; border-bottom: dashed 1px #333; }
table.tablesorter tbody tr.odd td { background-color: #F0F0F6; }
table.tablesorter thead tr .headerSortUp { background-image: url(images/asc.gif) no-repeat; }
table.tablesorter thead tr .headerSortDown { background-image: url(images/desc.gif) no-repeat; }
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { background-color: #8dbdd8; } …
Run Code Online (Sandbox Code Playgroud)

html css html-table

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

无限循环与do功能

我试图在do while函数中运行一些代码:

do {
    printf("\nThis game has two different modes: I Guess, You Guess\n");
    Sleep(2000);
    printf("Which mode do you want to play?\n");
    cin >> mStr;
    cout << "Are you sure you want to play " << mStr << " mode?";
    cin >> choice;
} while (choice != "No");
Run Code Online (Sandbox Code Playgroud)

但是,每次我输入mStr(一个char数组)时,它都会重新启动.它甚至没有执行cout.

以下是名为char的数组:

char mStr[10];
char choice[4];
Run Code Online (Sandbox Code Playgroud)

另外,我怎么能用printf()而不是cout呢?我正努力练习.

编辑:

这是新代码:

do {
    printf("\nThis game has two different modes: I Guess, You Guess\n");
    Sleep(2000);
    printf("Which mode do you want to play?\n");
    cin >> mStr; …
Run Code Online (Sandbox Code Playgroud)

c++ loops do-while

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

标签 统计

c++ ×3

css ×1

do-while ×1

function ×1

html ×1

html-table ×1

loops ×1

macos ×1

windows ×1