我是c ++的新手,我正在用visual c ++制作一个程序.在出现此错误之前,一切都很顺利:
error C2440: '==' : cannot convert from 'const char [11]' to'System::Windows::Forms::TextBox ^'
Run Code Online (Sandbox Code Playgroud)
我很确定它与我在文本框中放入数字而不是单词有关.
这是代码的一部分:
if (fnum==true){
if (phoneNum=="555555555"){ // i think this part causes the problem
//code for when the phone number is correct
} else {
//if phone number is not correct
}
}
Run Code Online (Sandbox Code Playgroud)
我试过把'5555555555'代替"5555555555",但它给了我一个不同的错误
error C2015: too many characters in constant
error C2446: '==' : no conversion from 'int' to 'System::Windows::Forms::TextBox ^'
Run Code Online (Sandbox Code Playgroud)
下面是代码的其余部分:
#pragma once
#include <stdio.h>
#include <Windows.h>
bool fnum = true;
bool …Run Code Online (Sandbox Code Playgroud)