Cpp-Podstawy/8-Funkcje/1-Funkcje/4/main.cpp
2025-05-07 10:43:17 +02:00

21 lines
497 B
C++

/*
NAPISZ FUNKCJE CZY PARZYSTA KTORA PRZYJMUJE LICZBE CALKOWITA I ZWRACA TRUE JESLI JEST PARSZYSTA
boolalpha - manipulator strumienia, powoduje ze wartosc typu bool czyli true lub false
beda wyswietlane i odczytywane jako slowo true / false zamiast liczby 0 / 1
*/
#include <ios>
#include <iostream>
using namespace std;
bool czy_parzysta(int a) {
return a%2==0;
}
int main() {
cout << "Liczba jest parszysta? (" << boolalpha << czy_parzysta(2) << ")\n";
return 0;
}