-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path44C++Uvod2.cpp
More file actions
102 lines (73 loc) · 2.1 KB
/
Copy path44C++Uvod2.cpp
File metadata and controls
102 lines (73 loc) · 2.1 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <iostream>
#include <iomanip>
#include <limits>
using namespace std;
int main(void){
/*
int a = 100;
float b = 3.1415F;
const char * r = "Testovaci zprava";
// vypis s pomoci mapnipulatoru
cout << "A1: >" << a << "<" << endl;
cout << "A2: >" << setw(5) << a << "<" << endl;
cout << "A3: >" << setw(10) << setfill('_') << a << "<" << endl;
cout << "B1: >" << b << "<" << endl;
cout << "B2: >" << setw(10) << setfill(' ') << b << "<" << endl;
cout << "B3: >" << setw(10) << setprecision(3) << b << "<" << endl;
cout << "B4: >" << setw(20) << setprecision(20) << b << "<" << endl;
cout << "B5: >" << setw(10) << setfill(' ') << left << b << "<" << endl;
cout << "B6: >" << setw(10) << fixed << setprecision(2) << b << "<" << endl;
cout << "Retezec1: >" << setw(20) << uppercase << r << "<" << endl;
cout << "Retezec2: >" << nouppercase << r << "<" << endl;
*/
// Tabulka nasobilky
/*
cout << " ";
for(int i=1; i<=10; i++){
cout << setw(3) << right
<< setfill(' ') << i << " ";
}
cout << endl;
cout << setw(4*10+3-1) << setfill('_') << "_" << endl;
for(int r=10; r <=20; r++){
cout << r << ":";
for(int s=1; s<=10; s++){
cout << setw(3) << right
<< setfill(' ') <<r*s << " ";
}
cout << endl;
}
*/
// Vstup od uzivatele
int x;
double y;
int _auto;
char retezec[100];
char znak;
cout << "Zadejte int: ";
cin >> x;
while(!cin){
cout << "Spatne zadani, zkuste znovu.\n";
cin.clear();
// vycisteni vstupniho zasobniku
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cin >> x;
}
cout << "Zadejte double: ";
cin >> y;
// vycisteni vstupniho zasobniku
cin.ignore(1000,'\n');
cout << "Zadejte znak: ";
cin >> znak;
// vycisteni vstupniho zasobniku
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cout << "Zadejte retezec: ";
cin.getline(retezec, 100);
cout << "X: " << x << endl;
cout << "Y: " << y << endl;
cout << "Znak: >" << znak << "<" << endl;
cout << "Retezec: >" << retezec << "<" << endl;
cout << "X + showpos : " << showpos << x << endl;
cout << "X + noshowpos: " << noshowpos << x << endl;
return 0;
}