int main () { float p,a; cout << "\nProgram pole trojkata\n" << "(C)2002 student\n\n"; cout << "Program oblicza pole trojkata rownobocznego o zadanym boku.\n\n"; cout << "Podaj dlugosc boku a= "; cin >> a; //obliczenia p = a * a * sqrt3 / 4.0f; cout << "\n\n\n Pole trojkata rownobocznego o boku a = " << a << " wynosi P= " << p << endl; system("PAUSE"); return 0; }
#include <cmath>
using namespace std;
const float sqrt3 = sqrtf(3.0f);
int main ()
{
float p,a;
cout << "\nProgram pole trojkata\n" << "(C)2002 student\n\n";
cout << "Program oblicza pole trojkata rownobocznego o zadanym boku.\n\n";
cout << "Podaj dlugosc boku a= ";
cin >> a;
//obliczenia
p = a * a * sqrt3 / 4.0f;
cout << "\n\n\n Pole trojkata rownobocznego o boku a = "
<< a << " wynosi P= " << p << endl;
system("PAUSE");
return 0;
}
#include <stdlib.h>
using namespace std;
int main ()
{
float p, a, h;
cout << "Program pole trojkata. (C)2002 student" << endl;
cout << "Program oblicza pole trojkata o zadanych podstawie i wysokosci." << endl << endl;
cout << "Podaj dlugosc podstawy a = ";
cin >> a;
cout << "Podaj dlugosc wysokosci h = ";
cin >> h;
p = (a * h)/2;
cout << "Pole trojkata o podstawie a = " << a << " i wysokosci h = " << h << " wynosi " << p << "." << endl;
system("PAUSE");
return 0;
}