如何将方程插入到c ++中 [英] how to insert equation to c ++

查看:73
本文介绍了如何将方程插入到c ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我是c ​​++的新用户我想运行程序但我没有使用c ++我想知道如何将方程式插入c ++

V_out = 1 /√(1 + w ^ 2 R ^ 2 c ^ 2)* V_in

hello am new user for c++ i would like to run programme but i haven''t use c++ i would like to know how can i insert equation to c++
V_out=1/√(1+w^2 R^2 c^2 )* V_in

推荐答案

您好Merook,

您的函数将如下所示:



Hi Merook,
your function would look like this:

#include <math.h>

double V_Out_Funct(double w, double R, double c, double V_In)
{
  return 1.0 / sqrt( 1.0 + pow(w, 2.0) * pow(R, 2.0) * pow(c, 2.0) ) * V_In;
}





你打电话给它(更新后的实施):





and you call it (updated implementation):

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

using namespace std;

double V_Out_Funct(double w, double R, double c, double V_In)
{
  return 1.0 / sqrt( 1.0 + pow(w, 2.0) * pow(R, 2.0) * pow(c, 2.0) ) * V_In;
}

int main()
{
  double W, R, C, V_In;
  // Input:
  cout << "Enter W:";
  cin >> W;
  cout << "Enter R:";
  cin >> R;
  cout << "Enter C:";
  cin >> C;
  cout << "Enter V_In:";
  cin >> V_In;

  // calculate the output
  double V_Out;
  V_Out = V_Out_Funct(W, R, C, V_In);
  cout << "V_Out is:" << V_Out;

  return 0;
}


这篇关于如何将方程插入到c ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆