#include "stdafx.h"
#include "iostream"
#include "string"
using namespace std;
void main()
{
string a = "a";
string b(1, -70); /*constructor, create a string having 1 character that its value is equal to -70*/
cout << (b > a ? b : a);
}
//output on screen: b was printed, not a (!)
Run Code Online (Sandbox Code Playgroud)
虽然b的值小于a的值,为什么b>a?我该如何纠正这种情况?
我正在做的是在无限循环中向一个图形交替显示2个图像,直到用户点击窗口关闭它.
#import things
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import cv2
import time
#turn on interactive mode for pyplot
plt.ion()
quit_frame = False
#load the first image
img = cv2.imread("C:\Users\al\Desktop\Image1.jpg")
#make the second image from the first one
imggray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
def onclick(event):
global quit_frame
quit_frame = not quit_frame
fig = plt.figure()
ax = plt.gca()
fig.canvas.mpl_connect('button_press_event', onclick)
i = 0
while quit_frame is False:
if i % 2 == 0: #if i is even, show the first image …Run Code Online (Sandbox Code Playgroud)