int f =0;
std::cout << " do you want to use 1. component y or n " << std::endl;
std::cin >>f;
if(f == 'y' || f =='n'){
if (f =='y'){
this->decisionvector[0] = 1;
}else
this->decisionvector[0] = 0;
}
std::cout << " do you want to use 2. component y or n " << std::endl;
std::cin >>f;
if(f == 'y' || f=='n'){
if (f =='y'){
this->decisionvector[1] = 2;
}else
this->decisionvector[1] = 0;
f= 0;
}
std::cin.clear();
std::cout << " do you want to use 3. component y or n " << std::endl;
std::cin >>f;
if(f == 'y' || f =='n'){
if (f =='y'){
this->decisionvector[2] = 4;
}else
this->decisionvector[2] = 0;
f= 0;
}
std::cin.clear();
std::cout << " do you want to use 4. component y or n " << std::endl;
std::cin >>f;
if(f == 'y' || f =='n'){
if (f =='y'){
this->decisionvector[3] = 8;
}else
this->decisionvector[3] = 0;
f= 0;
}
为什么我只能在第一个 if 语句中设置 f 程序不会在其他语句处停止?