C++ 有人能帮助确定为什么这不能正确执行吗?如果问题出在演员身上 #包括 #包括 使用名称空间std; int run_t=0; 查尔·库莫斯; 字符集; int main(){ cout>q_mos; 如果(q_mos=char(Y)){//出于某种原因,我有时间解析Y的值 while(run\u t=0){ 不能再继续下去了; 可能有几件事不对
在C++ 有人能帮助确定为什么这不能正确执行吗?如果问题出在演员身上 #包括 #包括 使用名称空间std; int run_t=0; 查尔·库莫斯; 字符集; int main(){ cout>q_mos; 如果(q_mos=char(Y)){//出于某种原因,我有时间解析Y的值 while(run\u t=0){ 不能再继续下去了; 可能有几件事不对,c++,while-loop,include,C++,While Loop,Include,在if(q_mos=char(Y))语句中 a) 您正在赋值,而不是比较(使用==而不是=)。这也适用于while循环 b) 将char(Y)替换为'Y',因为此时正在传递它,Y被认为是一个变量。这不应该编译。Y在使用之前从未声明过。我猜char(Y)应该是'Y'(或者可能是'Y').最后,我想将程序中的逻辑语句转换为通过某种形式的二进制操作进行测试。如果可能的话。因此,我不必同时测试这两种语句。谢谢。我被卡住了。今晚我将进行这些更改。 #include <iostream> #in
if(q_mos=char(Y))
语句中
a) 您正在赋值,而不是比较(使用==而不是=)。这也适用于while循环
b) 将
char(Y)
替换为'Y'
,因为此时正在传递它,Y被认为是一个变量。这不应该编译。Y在使用之前从未声明过。我猜char(Y)
应该是'Y'
(或者可能是'Y'
).最后,我想将程序中的逻辑语句转换为通过某种形式的二进制操作进行测试。如果可能的话。因此,我不必同时测试这两种语句。谢谢。我被卡住了。今晚我将进行这些更改。
#include <iostream>
#include <fstream>
using namespace std;
int run_t = 0;
char q_mos;
char i_pstring;
int main () {
cout << "Would you like to write to the temporary datapcku database?\nSelect Y/N\n";
cin >> q_mos;
if(q_mos = char(Y)){ //for some reason I am having time resolving the value of Y
while(run_t=0){
cout << "Running Input Operations.\n";
cout << "Please provide me with a Question so it can be achrived in the Active DB(Directory)\n";
cin >> i_pstring;
cout << "Please tell me the answer...\n";
cout << i_pstring;
}
run_t=1;
} else {
run_t=1;
cout << "Booting into main operations...\n";
}
cout << "At diagnostic Boot menu, prepare for diagnostic on system config orginaztional routines.\n";
ofstream binlib;
binlib.open ("datapcku.bin", ios::app | ios::binary );
binlib << "Writing this to a file.\n";
binlib.close();
while(1){}
return 0;
}