-4
結果計算します。誰も私が数日ループを学ぶことから、 は私が 特にプロトコルのループ部分にその を行うためにループを使用する方法を理解していないresultなどの円の面積(ループに)
をすることができます助けて?
私のコード:enter link description here
#include <iostream>
#include <iomanip>
using namespace std;
const double PI = 3.14159265;
void circle(int r1, int r2, double &d, double &c, double &a)
for(int i=r1;i<=r2;i++)
{
{
d=2*i;
c=2*PI*i;
a=PI*i*i;
}
}
int main(){
double d, c, a;
int r1, r2;
int r;
cout<<"enter 1st no.";
cin>>r1;
cout<<"enter 2nd no.";
cin>>r2;
cout << endl;
cout << setw(6) << "Radius";
cout << setw(10) << "Diameter";
cout << setw(15) << "Circumference";
cout << setw(10) << "Area" << endl;
circle(r1, r2, d, c, a);
for (int i=r1;i<=r2; i++)
{
cout<< setw(6)<<i<< setw(10)<<d<< setw(15)<<c<< setw(10)<<a<<endl;
}
return 0;
}
あなたは、 "プロトコルのループ部" とは何を意味するのですか?あなたは何を理解していませんか?コンパイラエラーはありますか?このコードは何をしていないのですか? – user463035818
あなたのコードはコンパイルされますか? – orbitcowboy
コードが動作しますが、私は実際にループを使って直径、周囲および面積を計算することを知らない。 – oid