Definición de constantes

Categorías: Lenguaje C++

   1 // definicion de constantes: calculo de una circunferencia
   2 
   3 #include <iostream>
   4 using namespace std;
   5 
   6 #define PI 3.14159
   7 #define NUEVALINEA '\n'
   8 
   9 int main ()
  10 {
  11   double r=5.0;               // radio
  12   double circle;
  13 
  14   circle = 2 * PI * r;
  15   cout << circle;
  16   cout << NUEVALINEA;
  17   cout << "\\n  \t linea nueva \n";
  18   cout << "\\t  \t tabulador \n";
  19   cout << "\\v  \t tabulador vertical \v\n";
  20   cout << "\\b  \t espacio en blanco \b\n";
  21   cout <<"\\a   \t alerta (beep) \a\n";
  22   cout <<"\\\'  \t comilla simple (\')\n";
  23   cout <<"\\\"  \t comillas dobles (\")\n";
  24   cout <<"\\\?  \t interrogacion (\?)\n";
  25   cout <<"\\    \t backslash (\\)\n"; 
  26 
  27   return 0;
  28 }

Algoritmantes/Constantes (last edited 2008-04-20 14:38:34 by localhost)