// include the basic windows header file
#include <windows.h>
#include <windowsx.h>
// the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam);
// the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow) {
// the handle for the window, filled by a function
HWND hWnd;
// this struct holds information for the window class
WNDCLASSEX wc;
// clear out the window class for use
ZeroMemory(&wc, sizeof(WNDCLASSEX));
// fill …Run Code Online (Sandbox Code Playgroud) 我得到这个代码:
System.out.println("Enter the brand and cash value");
String brand = keyboard.nextLine();
long cash = keyboard.nextDouble();
String buffer = keyboard.nextLine();
Run Code Online (Sandbox Code Playgroud)
但即使我输入了要与之比较的确切字符串值,它也无法识别它们是相同的。奇怪的是,当我输入这个时:
compare[0] = new Car ("BMW", 12.00);
而不是这个:
compare[0] = new Car (brand, 12.00);
有用
我也使用等于:
public boolean equals(Car other)
{
if (other == null)
{
return false;
}
if(this.brand == other.brand && this.cash == other.cash)
{
return true;
}
else
{
return false;
}
}
Run Code Online (Sandbox Code Playgroud) int len = GetWindowTextLengthW(hwndEdit) + 1;
wchar_t text[len];
Run Code Online (Sandbox Code Playgroud)
我明白了
错误2错误C2466:无法分配常量大小的数组0
错误3错误C2133:'text':未知大小
错误1错误C2057:预期的常量表达式
我不明白为什么它不会编译,因为GetWindowTextLengthW(hwndEdit)+ 1> 0
null + 1 = 1不是真的吗?