User Tools

Site Tools


cpp:define:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cpp:define:start [2017/07/31 22:44]
Daniel Gohlke d
— (current)
Line 1: Line 1:
-===== #define ===== 
- 
-<code cpp> 
-#define cpp cout << "C++" << endl; 
-</code> 
- 
-#define is used for creating names that will overwrite the current event.  
- 
-For example: 
- 
-<code cpp> 
- 
-// we are going to make a program that will use a #define for replacing a number 
- 
-#include <iostream> 
-#include <cmath> 
- 
-#define FIVE 5 
- 
-using namespace std; 
- 
-int main() { 
- 
-   cout << "The normal square root of 5 is: " << sqrt(FIVE) << endl; 
-   cout << "The int square root of 5 is: " << (int)sqrt(FIVE) << endl; 
-   return 0; 
-} 
-</code> 
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz