小编Rya*_* M.的帖子

SEMF物理C++代码

需要一些帮助来解决这个程序的一个小问题.我已经在C++的物理学中创建了SEMF来计算公式,一切都很好,但我的BE公式中包含了a5.

它说错误:标识符"a5"是未定义的,我知道这意味着什么,但如果我输入偶数甚至奇数或奇数奇数,我将如何从选择语句中获取a5.

#include <iostream>
#include <cstdlib>
#include <math.h>

using namespace std;

int main()
{
    int A, Z;

    // Main body of Semi-Empirical Mass Formula
    cout <<"Enter the mass number A: ";
    cin >> A;
    cout <<"\n";
    cout <<"Enter the atomic number Z: ";
    cin >> Z;
    cout <<"\n";

    // Constants from formula, units in MeV(millions of electron volts)
    double a1 = 15.67;          
    double a2 = 17.23;
    double a3 = 0.75;
    double a4 = 93.2;

    if(Z % 2 == 0 && …
Run Code Online (Sandbox Code Playgroud)

c++ physics

3
推荐指数
1
解决办法
453
查看次数

标签 统计

c++ ×1

physics ×1