我在这个棒球计算器中的switch语句出错了.错误说:"控制转移绕过初始化:"
switch语句用于您希望在此程序中执行的计算类型,例如:
在基本百分比击球平均值等...
// Baseball Stat.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
char menu_choice;
// Batting average formula.
float b_average(float hits, float bats) {return hits/bats;};
// On base percentage formula
float OBP(float hits, float walks, float Hit_by_Pitch, float bats, float sac_flys) {return (hits+walks+Hit_by_Pitch) / (bats+walks+Hit_by_Pitch+sac_flys);};
// Strikeout Ratio Formula
float Strikeout_ratio(float strikeouts, float bats) {return strikeouts/bats;};
// Fielding Average Formula
float fielding_average(float putouts, float assists, …Run Code Online (Sandbox Code Playgroud)