Descriere:Practic, functia #define iti permite sa inlocuiesti functii cu unele facute de tine...Este destul de greu de explicat in cuvinte, asa ca voi lasa codul sa vorbeasca de la sine.
Download:-
Autor:BreaKer
Sursa (Link-ul oficial):csharp.com
Propria parere:Folositor.
Tutorialul:
De exemplu:
Codul
Cod: Selectaţi tot
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int option;
cout << "Alegeti un numar intre 1 si 3" << endl;
cin >> option;
if ( option == 1 ) {
cout << "Ati ales sa inchideti programul" << endl;
_sleep(1000);
system("CLOSE");
}
else if ( option == 2 || option == 3 ) {
cout << "Nothing happened" << endl;
system("PAUSE");
}
}Cod: Selectaţi tot
#include <cstdlib>
#include <iostream>
#define arata cout
#define scrie cin
#define wait(x) _sleep(x*1000)
#define daca if
#define altfel else if
#define functie system
using namespace std;
int main(int argc, char *argv[])
{
int option;
arata << "Alegeti un numar intre 1 si 3" << endl;
scrie >> option;
if ( option == 1 ) {
arata << "Ati ales sa inchideti programul" << endl;
wait(1);
functie("CLOSE");
}
altfel ( option == 2 || option == 3 ) {
arata << "Nothing happened" << endl;
functie("PAUSE");
}
}Cod: Selectaţi tot
#define arata cout
#define scrie cin
#define wait(x) _sleep(x*1000)
#define daca if
#define altfel else if
#define functie systemCod: Selectaţi tot
#define functiata functia defaultCod: Selectaţi tot
#define adunare(x, y) x+y
