Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void show_ascii_table() {
- int k = 0;
- while (k <= 255) {
- cout << k << " - " << (char)k << endl;
- k++;
- }
- }
- int dice() {
- return rand() % 6 + 1;
- }
- void show_dice(int val) {
- switch (val) {
- case 1:
- cout << R"(
- +-----+
- | |
- | @ |
- | |
- +-----+
- )" << endl;
- break;
- case 2:
- cout << R"(
- +-----+
- |@ |
- | |
- | @|
- +-----+
- )" << endl;
- break;
- case 3:
- cout << R"(
- +-----+
- |@ |
- | @ |
- | @|
- +-----+
- )" << endl;
- break;
- case 4:
- cout << R"(
- +-----+
- |@ @|
- | |
- |@ @|
- +-----+
- )" << endl;
- break;
- case 5:
- cout << R"(
- +-----+
- |@ @|
- | @ |
- |@ @|
- +-----+
- )" << endl;
- break;
- case 6:
- cout << R"(
- +-----+
- | @ @ |
- | @ @ |
- | @ @ |
- +-----+
- )" << endl;
- break;
- }
- }
- void test_dice() {
- do {
- show_dice(dice());
- show_dice(dice());
- getchar();
- } while (true);
- }
- void test_array() {
- /*
- int d1 = 2, d2 = 3, d3 = 5, d4=3, d5=4, d6=2;
- cout << d1 + d2 + d3 + d4 + d5 + d6 << endl;
- int sum = 0;
- for (int k = 1; k <= 6; k++) {
- sum += dk;
- }
- */
- int d[6];
- d[0] = 2; d[1] = 3; d[2] = 4;
- d[3] = 3; d[4] = 2; d[5] = 5;
- int sum = 0;
- for (int k = 1; k < 6; k += 2) {
- cout << d[k];
- if (k < 5)
- cout << " + ";
- else
- cout << " = ";
- sum += d[k];
- }
- cout << sum << endl;
- }
- void show_reversarray() {
- //0 1 2 3
- double arr[]{1.01, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.1};
- double arr2[100]{};
- for (int k = 9; k >= 0; k--) {
- cout << arr[k] << " ";
- }
- cout << endl;
- //arr[0] = 1.0; arr[0] = 2.2;
- }
- int main(){
- srand(time(NULL));
- //show_ascii_table();
- //show_dice(1);
- //test_dice();
- show_reversarray();
- //test_array();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement