gpt4 book ai didi

c++ - 如何仅用斜边和纵横比计算直角三角形的边长?

转载 作者:行者123 更新时间:2023-11-27 23:48:52 25 4
gpt4 key购买 nike

<分区>

程序的要点是在您知道对角线尺寸和纵横比的情况下告诉您显示器的宽度和高度。这是我到目前为止的代码,但我不确定在给定数据时如何正确计算 widthIn 和 heightIn。

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

using namespace std;

int main()
{
double width, height, diagonal, widthIn, heightIn, aspectRatio, mathPlaceholder;

//Data Collection
cout << "Enter the width value of the display: ";
cin >> width;

cout << "Enter the height value of the display: ";
cin >> height;

cout << "Enter the length of the diagonal in inches: ";
cin >> diagonal;

//Calculations


//Outputting Results
cout << "\n The width of your display is " << widthIn << " inches." << endl;
cout << "The height of your display is " << heightIn << " inches." << endl;



return 0;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com