开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
dev c++
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
问题出现在这段程式码
quardilateral = 1;
while(quardilateral = 0) {
预期的正确结果(Expected Output):
quardilateral = 1;
while(quardilateral = 0) {
while不执行
quardilateral = 0;
while(quardilateral = 0) {
while执行
quardilateral = 1;
while(quardilateral = 1) {
while执行
quardilateral = 0;
while(quardilateral = 1) {
while不执行
错误结果(Wrong Output):
实际结果却是
quardilateral = 1;
while(quardilateral = 0) {
while不执行
quardilateral = 0;
while(quardilateral = 0) {
while不执行
quardilateral = 1;
while(quardilateral = 1) {
while执行
quardilateral = 0;
while(quardilateral = 1) {
while执行
程式码(Code):(请善用置底文网页, 记得排版)
// 引入标准程式库中相关的输入、输出程式
#include <iostream>
// 引入标准程式库中相关的字串程式
#include <string>
#include <math.h>
//std 为标准程式库的命名空间
using namespace std;
int main(void) {
double a;
double b;
double c;
double d;
printf("please enter the fixed edge of a quardrilateral\n");
cin >>a;
printf("please enter others edge of quardrilateral\n");
cin >>b;
cin >>c;
cin >>d;
double sita;
sita=0;
double diagonal;
diagonal=pow(pow(a,2)+pow(b,2)-2*a*b*cos(sita),0.5);
int quardilateral ;
quardilateral = 1;
while(quardilateral = 0) {
if (c+d>diagonal,c+diagonal>d,d+diagonal>c){
quardilateral = 1;
sita=sita+0.01;
cout << sita << endl;
}
else{
quardilateral = 0;
cout << quardilateral << endl;
}
}
system("pause");
return 0;
}
补充说明(Supplement):
while执行与否完全无规则
有时候判断true执行
有时候判断false执行
怎么会这样