我有两个名为 RUN 和 KILL 的切换按钮。当我打开(即按下)RUN 按钮时,我只想通过按下 KILL 切换按钮来关闭它(而不是通过关闭 RUN 按钮)。我希望在 RUN 按钮上的任何后续鼠标点击都不执行任何操作,除非按下 KILL 按钮。同样,当 KILL 按钮打开时,我只希望它通过按下 RUN 按钮来关闭(同样,不是通过关闭 KILL 按钮)。我不确定如何构造将这两个切换按钮的操作绑定在一起的事件处理程序。我将 GTK+ 与 Glade 和 C 编程一起使用。
以下最小示例显示了该问题:
#include <math.h>
#include <iostream>
int main()
{
double a = log10(1/200);
double b = log10(0.005);
std::cout << "The value of a is " << a << " and b is " << b << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
我使用 g++ 编译程序:
g++ -o math math.cpp
./math
Run Code Online (Sandbox Code Playgroud)
程序的输出是:
The value of a is -inf and b is -2.30103
Run Code Online (Sandbox Code Playgroud)
C 也会发生同样的事情:
#include <math.h>
#include <stdio.h>
int main()
{
double a = log10(1/200);
double b = log10(0.005);
printf("The value of a is %f and …Run Code Online (Sandbox Code Playgroud)