-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtypy-danych.cpp
58 lines (48 loc) · 1.51 KB
/
typy-danych.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// typy-danych.cpp
// 1-programowanie-strukturalne\1-1-podstawy-programowania\1-1-1-struktura-prostego-programu-cpp\
//
// Created by Jakub Piskorowski on 30/12/2021 wersja: 1.0
// Copyright © 2021 Jakub Piskorowski. All rights reserved.
// GitHub: https://github.com/PiskorowskiJakub/programming-course-cpp
//
// Przedstawienie podstawowych typow danych
//
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
// Typy całkowite
short a = 32767;
int b = 2147483647;
long c = 2147483647;
long long d = 9223372036854775807;
cout << "short " << a << endl;
cout << "int " << b << endl;
cout << "long " << c << endl;
cout << "long long " << d << endl;
unsigned short e = 65535;
unsigned int f = 4294967295;
unsigned long g = 4294967295;
unsigned long long h = 18446744073709551615;
cout << "short " << e << endl;
cout << "int " << f << endl;
cout << "long " << g << endl;
cout << "long long " << h << endl;
// Typy rzeczywiste
float i = 1.123456;
double j = 1.12345678912345;
long double k = 1.123456789123456;
cout << "float "<< fixed << setprecision(6) << i << endl;
cout << "double "<< fixed << setprecision(14) << j << endl;
cout << "long double "<< fixed << setprecision(15) << k << endl;
// Typ znakowy
char l = '$';
cout << "char " << l << endl;
// Typ logiczny
bool m = true;
bool n = false;
cout << "bool true " << m << endl;
cout << "bool false " << n << endl;
return 0;
}