私はC++の学習を始めたばかりで、円の面積を見つけるためのプログラムを作成しようとしています. プログラムを作成しましたが、コンパイルしようとすると、2 つのエラー メッセージが表示されます。1 つ目は次のとおりです。
areaofcircle.cpp:9:14: error: expected unqualified-id before numeric constant
2番目は次のとおりです。
areaofcircle.cpp:18:5: error: 'area' was not declared in this scope
私は何をすべきか?写真を投稿したいのですが、私は新しいユーザーなので投稿できません。
#include <iostream>
using namespace std;
#define pi 3.1415926535897932384626433832795
int main()
{
// Create three float variable values: r, pi, area
float r, pi, area;
cout << "This program computes the area of a circle." << endl;
// Prompt user to enter the radius of the circle, read input value into variable r
cout << "Enter the radius of the circle " << endl;
cin >> r;
// Square r and then multiply by pi area = r * r * pi;
cout << "The area is " << area << "." << endl;
}