All pastes #550211 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-08 11:02 UTC
rendered paste body
#include <iostream>
#include <string>
using namespace std;

// let's define some pre-processor replacements
#define pi 3.14159
#define ALERT '\a'

// open main function
int main()
{
    /* demonstration here shows declaration of vars with "initial values
    showing how you can give a variable a value within the declaration itself */
    int a(5), b(10), result;
    double circle, circlearea;
    // let's define some constants
    const int num1 (3);
    const int num2 (5);
    // this example defines a new string which can be set within the main function
    string test;
    // this example shows a predefined string value
    string test2 ("This is my string with a predefined value!");
    // give them values
    result = a + b;
    circle = 2 * pi * num1;
    circlearea = pi * num2 * num2;
    

    
    // print results
    std::cout << "Hello, world!" << std::endl;
    std::cout << result << std::endl;
    test = "This is my string value!";
    std::cout << test << std::endl;
    std::cout << test2 << std::endl;
    std::cout << "Let's make some random beeping noises.";
    std::cout << ALERT;
    
    // let's print some multuiplication with our constants
    std::cout << circle << std::endl;
    std::cout << circlearea << std::endl;
    
    
    // terminate
    return 0;
}