User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







cpp:define:start

This is an old revision of the document!


#define

#define cpp cout << "C++" << endl;

#define is used for creating names that will overwrite the current event.

For example:

// we are going to make a program that will use a #define for replacing a number
 
#include <iostream>
#include <cmath>
 
#define INT_FIVE int i = 5;
#define DOUBLE_FIVE double d = 5;
 
int main() {
 
   cout << "The normal square root of 5 is: " << sqrt(DOUBLE_FIVE) << endl;
   cout << "The int square root of 5 is: " << (int)sqrt(INT_FIVE) << endl;
   return 0;
}

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
cpp/define/start.1395146586.txt · Last modified: 2024/02/16 01:02 (external edit)

Impressum Datenschutz