Last active
July 12, 2017 07:23
-
-
Save SteelPh0enix/53d9c1fe693ae3c266536cea7d5c2563 to your computer and use it in GitHub Desktop.
proper variable initialiser-list initialisation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
//operacja dodawania | |
int sum {2 + 2}; | |
//operacja mnożenia | |
int multiplication {3 * 4}; | |
//dzielenie z użyciem operatora przypisania | |
int division = 6; | |
division /= 3; | |
//reszta z dzielenia - oczywiście w takich operacjach możemy również wykorzystywać inne zmienne, zamiast podawać bezpośrednio dane. | |
int modulo {3 % division}; | |
//wypisanie wyników | |
std::cout << "sum = " << sum << std::endl | |
<< "multiplication = " << multiplication << std::endl | |
<< "division = " << division << std::endl | |
<< "modulo = " << modulo << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment