Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
BAC计算器在到达主函数之前一直以退出代码0x0结束 我试图用C++编写一个BAC计算器,但是程序在退出程序之前一直以退出代码0x0结束。我做错了什么 #include <iostream> #include <string> using namespace std; double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); double OverBAC(double); double timetillzero(double); double Timetillbelowlegallimit(double); string degreeofdrunkness(double); int main() { // Declaration Statements double value_one = 0; double value_two = 0; double value_three = 0; double value_four = 0; double value_five = 0; double value_six = 0; double value_seven = 0; double value_eight = 0; double value_nine = 0; double value_ten = 0; double weight = 0; double BAC = 0; string degreeofdrunkness1; double age = 0; double number = 0; double gender = 0; double OverBAC1 = 0; // Input { cout << "There are 12 choices for helping in deciding BAC. 1 = number of number of of 12 oz.regular beer that was drunk. 2 = number of 12 oz.light beer drunk. 3 = number of 4 oz.port house wine drunk. 4 = number of 4 oz.burgundy wine drunk. 5 = the number of 4 oz.rose wine drunk. 6 = number of 1.5 oz. 100 proof vodka drunk. 7 = number of 1.5 oz. 80 proof vodka drunk. 8 = number of 1.5 oz. 80 proof bourbon drunk. 9 = weight. 10 = age. 11 = gender. 12 = execute the program." << endl; cin >> number; cout << "Please give the number of of 12 oz.regular beer that was drunk." << endl; cin >> value_one; cout << "Please give the number of 12 oz.light beer drunk." << endl; cin >> value_two; cout << "Please give the number of 4 oz.port house wine drunk." << endl; cin >> value_three; cout << "Please give the number of 4 oz.burgundy wine drunk." << endl; cin >> value_four; cout << "Please give the number of 4 oz.rose wine drunk." << endl; cin >> value_five; cout << "Please give the number of 1.5 oz. 100 proof vodka drunk." << endl; cin >> value_six; cout << "Please give the number of 1.5 oz. 80 proof vodka drunk." << endl; cin >> value_seven; cout << "Please give the number of 1.5 oz. 80 proof bourbon drunk." << endl; cin >> value_eight; cout << "Please enter your weight." << endl; cin >> weight; cout << "Please input age." << endl; cin >> age; cout << "Please enter your gender here and press enter. 1=Male 2=Female" << endl; cin >> gender; //Process double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); // Function Call OverBAC(BAC);//Function Call degreeofdrunkness1 = degreeofdrunkness(BAC); // Function Header value_ten = timetillzero(BAC); value_nine = Timetillbelowlegallimit(BAC); } // Output cout << "Your BAC is" << BAC << endl; cout << "Your OverBAC is" << OverBAC1 << endl; cout << "It will take" << value_ten << "hours." << endl; cout << "It will take" << value_nine << "hours to get below the legal limit." << endl; cout << "You are" << degreeofdrunkness1 << "." << endl; return 0; } /**************************************************************************/ // Function Definition : Calc // Precondition : The number of each type of drink, along with sex, weight, and age are received as call by value parameters. // Operation : The BAC will be calculated based on the number of each type of drink, age, sex, and weight and return the value. // Postcondition : The value will be returned as an integer to the calling function. //Function Header double Calc(double value_one, double value_two, double value_three, double value_four, double value_five, double value_six, double value_seven, double value_eight, double age, double weight, double gender) { // Declaration Statements double BAC = 0; // Process if (gender = 1) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.51) * 100); if (gender = 1) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.61) * 100); if (gender = 2) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.52) * 100); if (gender = 2) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.46) * 100); // Output return BAC; } //**end of calc function***********************************************************// /****************************************************************************/ // Function Definition : OverBAC // Precondition : The function receives the BAC integer value from the Calc Module. // Condition : The function will subtract the legal limit of BAC from the BAC integer that was called and return the answer. // Postcondition : The value will be returned as an integer to the header module. double OverBAC(double BAC) //Function Header { // Declaration Statements double OverBAC1 = 0; // Process OverBAC1 = (BAC - 0.08); // Output return OverBAC1; } /**end of OverBAC function*********************************************************/ // Function Definition : timetillzero Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC by .12 in order to get the hours needed to become completely sober. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************************/ double timetillzero(double BAC) // Function Header { // Declaration Statements double value_ten = 0; // Process value_ten = BAC / .12; //Output return value_ten; } /**end of Timetillzero function*************************************************/ // Timetillbelowlegallimit Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC value by .12 until it is below .08. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************// double Timetillbelowlegallimit(double BAC) // Function Header { // Declaration Statements double value_nine = 0; // Process value_nine = BAC - .08 / .12; // Output return value_nine; } //**end of Timetillbelowlegallimit function***********************************// //******************************************************************************************************************// // Message for degree of drunkness module // Precondition : The function receives the BAC integer value from the main module. // Operation : If the BAC is a certain value, then the BAC integer will be sent back along with the message. // Postcondition : The value will be sent back as a string to the header module and send back the degree of drunkness string value //*******************************************************************************************************************// string degreeofdrunkness(double BAC) // Function Header { // Declaration Statement string degreeofdrunkness1; // Process if (BAC > .01) (BAC < .05), degreeofdrunkness1 = "Subclinical"; if (BAC > .03) (BAC < .12), degreeofdrunkness1 = "Euphoria"; if (BAC > .09) (BAC < .25), degreeofdrunkness1 = "Excitement"; if (BAC > .18) (BAC < .30), degreeofdrunkness1 = "Confusion"; if (BAC > .25) (BAC < .40), degreeofdrunkness1 = "Stupor"; if (BAC > .35) (BAC < .50), degreeofdrunkness1 = "Coma"; if (BAC > .45) degreeofdrunkness1 = "Death"; // Output return degreeofdrunkness1; } //**end of function********************************************************// #包括 #包括 使用名称空间std; 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双体重、双性别); 双过肩(双); 双时差零(双); 双倍计时至低于WLEGALLIMIT(双倍); 串度/厚度(双); int main() { //声明声明 双值_one=0; 双值_two=0; 双值_三=0; 双值四=0; 双值_五=0; 双值_六=0; 双值_七=0; 双值_八=0; 双值_九=0; 双值_十=0; 双倍重量=0; 双BAC=0; 串度FDRUNKNESS1; 双倍年龄=0; 双数=0; 双重性别=0; 双超AC1=0; //输入 { 库特数; 不能评价一个人; 不能评价二者; 不能重视三个方面; 四不能值; 不能评价五; 不能评价六; 不能评价七; 不能评价八; 重量; 年龄; 性别差异; //过程 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双重量、双性别);//函数调用 OverBAC(BAC);//函数调用 degreeofdrunkness 1=degreeofdrunkness(BAC); //函数头 值_十=时间零点(BAC); 值_-nine=Timetillbelowlegallimit(BAC); } //输出 cout_C++ - Fatal编程技术网

BAC计算器在到达主函数之前一直以退出代码0x0结束 我试图用C++编写一个BAC计算器,但是程序在退出程序之前一直以退出代码0x0结束。我做错了什么 #include <iostream> #include <string> using namespace std; double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); double OverBAC(double); double timetillzero(double); double Timetillbelowlegallimit(double); string degreeofdrunkness(double); int main() { // Declaration Statements double value_one = 0; double value_two = 0; double value_three = 0; double value_four = 0; double value_five = 0; double value_six = 0; double value_seven = 0; double value_eight = 0; double value_nine = 0; double value_ten = 0; double weight = 0; double BAC = 0; string degreeofdrunkness1; double age = 0; double number = 0; double gender = 0; double OverBAC1 = 0; // Input { cout << "There are 12 choices for helping in deciding BAC. 1 = number of number of of 12 oz.regular beer that was drunk. 2 = number of 12 oz.light beer drunk. 3 = number of 4 oz.port house wine drunk. 4 = number of 4 oz.burgundy wine drunk. 5 = the number of 4 oz.rose wine drunk. 6 = number of 1.5 oz. 100 proof vodka drunk. 7 = number of 1.5 oz. 80 proof vodka drunk. 8 = number of 1.5 oz. 80 proof bourbon drunk. 9 = weight. 10 = age. 11 = gender. 12 = execute the program." << endl; cin >> number; cout << "Please give the number of of 12 oz.regular beer that was drunk." << endl; cin >> value_one; cout << "Please give the number of 12 oz.light beer drunk." << endl; cin >> value_two; cout << "Please give the number of 4 oz.port house wine drunk." << endl; cin >> value_three; cout << "Please give the number of 4 oz.burgundy wine drunk." << endl; cin >> value_four; cout << "Please give the number of 4 oz.rose wine drunk." << endl; cin >> value_five; cout << "Please give the number of 1.5 oz. 100 proof vodka drunk." << endl; cin >> value_six; cout << "Please give the number of 1.5 oz. 80 proof vodka drunk." << endl; cin >> value_seven; cout << "Please give the number of 1.5 oz. 80 proof bourbon drunk." << endl; cin >> value_eight; cout << "Please enter your weight." << endl; cin >> weight; cout << "Please input age." << endl; cin >> age; cout << "Please enter your gender here and press enter. 1=Male 2=Female" << endl; cin >> gender; //Process double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); // Function Call OverBAC(BAC);//Function Call degreeofdrunkness1 = degreeofdrunkness(BAC); // Function Header value_ten = timetillzero(BAC); value_nine = Timetillbelowlegallimit(BAC); } // Output cout << "Your BAC is" << BAC << endl; cout << "Your OverBAC is" << OverBAC1 << endl; cout << "It will take" << value_ten << "hours." << endl; cout << "It will take" << value_nine << "hours to get below the legal limit." << endl; cout << "You are" << degreeofdrunkness1 << "." << endl; return 0; } /**************************************************************************/ // Function Definition : Calc // Precondition : The number of each type of drink, along with sex, weight, and age are received as call by value parameters. // Operation : The BAC will be calculated based on the number of each type of drink, age, sex, and weight and return the value. // Postcondition : The value will be returned as an integer to the calling function. //Function Header double Calc(double value_one, double value_two, double value_three, double value_four, double value_five, double value_six, double value_seven, double value_eight, double age, double weight, double gender) { // Declaration Statements double BAC = 0; // Process if (gender = 1) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.51) * 100); if (gender = 1) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.61) * 100); if (gender = 2) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.52) * 100); if (gender = 2) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.46) * 100); // Output return BAC; } //**end of calc function***********************************************************// /****************************************************************************/ // Function Definition : OverBAC // Precondition : The function receives the BAC integer value from the Calc Module. // Condition : The function will subtract the legal limit of BAC from the BAC integer that was called and return the answer. // Postcondition : The value will be returned as an integer to the header module. double OverBAC(double BAC) //Function Header { // Declaration Statements double OverBAC1 = 0; // Process OverBAC1 = (BAC - 0.08); // Output return OverBAC1; } /**end of OverBAC function*********************************************************/ // Function Definition : timetillzero Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC by .12 in order to get the hours needed to become completely sober. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************************/ double timetillzero(double BAC) // Function Header { // Declaration Statements double value_ten = 0; // Process value_ten = BAC / .12; //Output return value_ten; } /**end of Timetillzero function*************************************************/ // Timetillbelowlegallimit Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC value by .12 until it is below .08. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************// double Timetillbelowlegallimit(double BAC) // Function Header { // Declaration Statements double value_nine = 0; // Process value_nine = BAC - .08 / .12; // Output return value_nine; } //**end of Timetillbelowlegallimit function***********************************// //******************************************************************************************************************// // Message for degree of drunkness module // Precondition : The function receives the BAC integer value from the main module. // Operation : If the BAC is a certain value, then the BAC integer will be sent back along with the message. // Postcondition : The value will be sent back as a string to the header module and send back the degree of drunkness string value //*******************************************************************************************************************// string degreeofdrunkness(double BAC) // Function Header { // Declaration Statement string degreeofdrunkness1; // Process if (BAC > .01) (BAC < .05), degreeofdrunkness1 = "Subclinical"; if (BAC > .03) (BAC < .12), degreeofdrunkness1 = "Euphoria"; if (BAC > .09) (BAC < .25), degreeofdrunkness1 = "Excitement"; if (BAC > .18) (BAC < .30), degreeofdrunkness1 = "Confusion"; if (BAC > .25) (BAC < .40), degreeofdrunkness1 = "Stupor"; if (BAC > .35) (BAC < .50), degreeofdrunkness1 = "Coma"; if (BAC > .45) degreeofdrunkness1 = "Death"; // Output return degreeofdrunkness1; } //**end of function********************************************************// #包括 #包括 使用名称空间std; 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双体重、双性别); 双过肩(双); 双时差零(双); 双倍计时至低于WLEGALLIMIT(双倍); 串度/厚度(双); int main() { //声明声明 双值_one=0; 双值_two=0; 双值_三=0; 双值四=0; 双值_五=0; 双值_六=0; 双值_七=0; 双值_八=0; 双值_九=0; 双值_十=0; 双倍重量=0; 双BAC=0; 串度FDRUNKNESS1; 双倍年龄=0; 双数=0; 双重性别=0; 双超AC1=0; //输入 { 库特数; 不能评价一个人; 不能评价二者; 不能重视三个方面; 四不能值; 不能评价五; 不能评价六; 不能评价七; 不能评价八; 重量; 年龄; 性别差异; //过程 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双重量、双性别);//函数调用 OverBAC(BAC);//函数调用 degreeofdrunkness 1=degreeofdrunkness(BAC); //函数头 值_十=时间零点(BAC); 值_-nine=Timetillbelowlegallimit(BAC); } //输出 cout

BAC计算器在到达主函数之前一直以退出代码0x0结束 我试图用C++编写一个BAC计算器,但是程序在退出程序之前一直以退出代码0x0结束。我做错了什么 #include <iostream> #include <string> using namespace std; double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); double OverBAC(double); double timetillzero(double); double Timetillbelowlegallimit(double); string degreeofdrunkness(double); int main() { // Declaration Statements double value_one = 0; double value_two = 0; double value_three = 0; double value_four = 0; double value_five = 0; double value_six = 0; double value_seven = 0; double value_eight = 0; double value_nine = 0; double value_ten = 0; double weight = 0; double BAC = 0; string degreeofdrunkness1; double age = 0; double number = 0; double gender = 0; double OverBAC1 = 0; // Input { cout << "There are 12 choices for helping in deciding BAC. 1 = number of number of of 12 oz.regular beer that was drunk. 2 = number of 12 oz.light beer drunk. 3 = number of 4 oz.port house wine drunk. 4 = number of 4 oz.burgundy wine drunk. 5 = the number of 4 oz.rose wine drunk. 6 = number of 1.5 oz. 100 proof vodka drunk. 7 = number of 1.5 oz. 80 proof vodka drunk. 8 = number of 1.5 oz. 80 proof bourbon drunk. 9 = weight. 10 = age. 11 = gender. 12 = execute the program." << endl; cin >> number; cout << "Please give the number of of 12 oz.regular beer that was drunk." << endl; cin >> value_one; cout << "Please give the number of 12 oz.light beer drunk." << endl; cin >> value_two; cout << "Please give the number of 4 oz.port house wine drunk." << endl; cin >> value_three; cout << "Please give the number of 4 oz.burgundy wine drunk." << endl; cin >> value_four; cout << "Please give the number of 4 oz.rose wine drunk." << endl; cin >> value_five; cout << "Please give the number of 1.5 oz. 100 proof vodka drunk." << endl; cin >> value_six; cout << "Please give the number of 1.5 oz. 80 proof vodka drunk." << endl; cin >> value_seven; cout << "Please give the number of 1.5 oz. 80 proof bourbon drunk." << endl; cin >> value_eight; cout << "Please enter your weight." << endl; cin >> weight; cout << "Please input age." << endl; cin >> age; cout << "Please enter your gender here and press enter. 1=Male 2=Female" << endl; cin >> gender; //Process double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seven, double& value_eight, double& age, double& weight, double& gender); // Function Call OverBAC(BAC);//Function Call degreeofdrunkness1 = degreeofdrunkness(BAC); // Function Header value_ten = timetillzero(BAC); value_nine = Timetillbelowlegallimit(BAC); } // Output cout << "Your BAC is" << BAC << endl; cout << "Your OverBAC is" << OverBAC1 << endl; cout << "It will take" << value_ten << "hours." << endl; cout << "It will take" << value_nine << "hours to get below the legal limit." << endl; cout << "You are" << degreeofdrunkness1 << "." << endl; return 0; } /**************************************************************************/ // Function Definition : Calc // Precondition : The number of each type of drink, along with sex, weight, and age are received as call by value parameters. // Operation : The BAC will be calculated based on the number of each type of drink, age, sex, and weight and return the value. // Postcondition : The value will be returned as an integer to the calling function. //Function Header double Calc(double value_one, double value_two, double value_three, double value_four, double value_five, double value_six, double value_seven, double value_eight, double age, double weight, double gender) { // Declaration Statements double BAC = 0; // Process if (gender = 1) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.51) * 100); if (gender = 1) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.61) * 100); if (gender = 2) if (age > 18) if (age < 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.52) * 100); if (gender = 2) if (age >= 40) BAC = ((value_one*13.6 + value_two*11.3 + value_three*16.4 + value_four*10.9 + value_five*10.0 + value_six*16.7 + value_seven*16.7 + value_eight*13.7) / ((weight / 2.2046)*0.46) * 100); // Output return BAC; } //**end of calc function***********************************************************// /****************************************************************************/ // Function Definition : OverBAC // Precondition : The function receives the BAC integer value from the Calc Module. // Condition : The function will subtract the legal limit of BAC from the BAC integer that was called and return the answer. // Postcondition : The value will be returned as an integer to the header module. double OverBAC(double BAC) //Function Header { // Declaration Statements double OverBAC1 = 0; // Process OverBAC1 = (BAC - 0.08); // Output return OverBAC1; } /**end of OverBAC function*********************************************************/ // Function Definition : timetillzero Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC by .12 in order to get the hours needed to become completely sober. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************************/ double timetillzero(double BAC) // Function Header { // Declaration Statements double value_ten = 0; // Process value_ten = BAC / .12; //Output return value_ten; } /**end of Timetillzero function*************************************************/ // Timetillbelowlegallimit Module : // Precondition : The function receives the BAC integer value from the Calc Module. // Operation : The function will divide the BAC value by .12 until it is below .08. // Postcondition : The value will be returned as an integer to the header module. //**************************************************************// double Timetillbelowlegallimit(double BAC) // Function Header { // Declaration Statements double value_nine = 0; // Process value_nine = BAC - .08 / .12; // Output return value_nine; } //**end of Timetillbelowlegallimit function***********************************// //******************************************************************************************************************// // Message for degree of drunkness module // Precondition : The function receives the BAC integer value from the main module. // Operation : If the BAC is a certain value, then the BAC integer will be sent back along with the message. // Postcondition : The value will be sent back as a string to the header module and send back the degree of drunkness string value //*******************************************************************************************************************// string degreeofdrunkness(double BAC) // Function Header { // Declaration Statement string degreeofdrunkness1; // Process if (BAC > .01) (BAC < .05), degreeofdrunkness1 = "Subclinical"; if (BAC > .03) (BAC < .12), degreeofdrunkness1 = "Euphoria"; if (BAC > .09) (BAC < .25), degreeofdrunkness1 = "Excitement"; if (BAC > .18) (BAC < .30), degreeofdrunkness1 = "Confusion"; if (BAC > .25) (BAC < .40), degreeofdrunkness1 = "Stupor"; if (BAC > .35) (BAC < .50), degreeofdrunkness1 = "Coma"; if (BAC > .45) degreeofdrunkness1 = "Death"; // Output return degreeofdrunkness1; } //**end of function********************************************************// #包括 #包括 使用名称空间std; 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双体重、双性别); 双过肩(双); 双时差零(双); 双倍计时至低于WLEGALLIMIT(双倍); 串度/厚度(双); int main() { //声明声明 双值_one=0; 双值_two=0; 双值_三=0; 双值四=0; 双值_五=0; 双值_六=0; 双值_七=0; 双值_八=0; 双值_九=0; 双值_十=0; 双倍重量=0; 双BAC=0; 串度FDRUNKNESS1; 双倍年龄=0; 双数=0; 双重性别=0; 双超AC1=0; //输入 { 库特数; 不能评价一个人; 不能评价二者; 不能重视三个方面; 四不能值; 不能评价五; 不能评价六; 不能评价七; 不能评价八; 重量; 年龄; 性别差异; //过程 双计算(双值一、双值二、双值三、双值四、双值五、双值六、双值七、双值八、双年龄、双重量、双性别);//函数调用 OverBAC(BAC);//函数调用 degreeofdrunkness 1=degreeofdrunkness(BAC); //函数头 值_十=时间零点(BAC); 值_-nine=Timetillbelowlegallimit(BAC); } //输出 cout,c++,C++,一个明显的错误在您的main中: double Calc(double& value_one, double& value_two, double& value_three, double& value_four, double& value_five, double& value_six, double& value_seve

一个明显的错误在您的
main
中:

    double Calc(double& value_one, double& value_two, 
                double& value_three, double& value_four, 
                 double& value_five, double& value_six, 
                 double& value_seven, double& value_eight, 
           double& age, double& weight, double& gender);   // Function Call
您正在执行函数声明,如果正在执行函数调用,请执行以下操作:

double res = double Calc(value_one,value_two, value_three, 
         value_four, value_five, value_six,  
          value_seven, value_eight, age, weight, gender);  
您需要稍后在
main
中使用返回的结果


此外,将
age
gender
声明为
double

是没有意义的。我刚刚编译并运行了您的代码。它按预期运行

g++4.9.2没有标志

但是你有很多语法是荒谬的,例如

if (BAC > .01) (BAC < .05),  degreeofdrunkness1 = "Subclinical";
if(BAC>.01)(BAC<.05),degreeofdrunkness1=“亚临床”;

您所说的“程序在到达主功能之前一直结束”是什么意思?您看到了什么输出?这就是它,一旦它到达函数调用,它就会以代码0x0退出,这就是输出。它只是跳过所有其他内容并停止运行。嗯,听起来是一个很好的调试器使用案例。它实际上已经很好地通过了调试器。是的,但我尝试在microsoft visual studio中运行它在C++中,它显然在第一个函数调用之前结束。我试图重新定义代码为浮点,并且在函数调用被注意之前仍然结束。函数被调用并以写的方式运行。您对工具和C++不熟悉。