Advertisement
dllbridge

Untitled

Nov 13th, 2023
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.58 KB | None | 0 0
  1. /*
  2.  
  3. #include <windows.h>
  4. #include   <stdio.h>
  5. #include  <locale.h>
  6.  
  7.  
  8.  
  9.  
  10.  
  11. ////////////////////////////////////////////////////////
  12. int main()                                            //
  13. {
  14.    
  15.      setlocale(LC_ALL, "Rus");
  16.    
  17.      printf("Привет! \n");
  18.      
  19.      
  20. //   printf(Rus("Мельница") );
  21. }
  22.  
  23.  
  24. */
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #include <windows.h>
  34. #include   <stdio.h>
  35.  
  36.  
  37.  
  38. LPCSTR Rus(LPCTSTR pszIn);
  39.  
  40. void ConsolePrint(const char* str, int Colour);
  41. void ConsolePrint(int Y, int X, const char* str, int Colour);
  42.  
  43.  
  44. ////////////////////////////////////////////////////////
  45. int main()                                            //
  46. {
  47.    
  48.  
  49.      
  50.      
  51.      printf(Rus("Мельница") );
  52.      
  53.      
  54.      ConsolePrint("SONY", 2);
  55.  
  56.      
  57.      ConsolePrint(7, 27, "Pictures", 4);     
  58.      ConsolePrint("",     15);
  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. LPCSTR Rus(LPCTSTR pszIn)
  99. {
  100.     static char szBuffer[MAX_PATH];
  101.     CharToOemBuff(pszIn, szBuffer, MAX_PATH);
  102.     return szBuffer;
  103. }
  104.  
  105.  
  106. void ConsolePrint(const char* str, int Colour)
  107. {
  108.      DWORD   result;
  109.      COORD    coord;
  110.      HANDLE  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  111.      SetConsoleTextAttribute(hStdout, Colour);                       //  Изменим цвет текста
  112.  
  113.      WriteConsole(hStdout, Rus(str), strlen(str), &result, 0);
  114. }
  115.  
  116. //   Y  - это строка, X - это позиция в строке
  117. //  ============================================
  118. void ConsolePrint(int Y, int X, const char* str, int Colour)
  119. {
  120.      DWORD   result;
  121.      COORD    coord;
  122.      HANDLE  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  123.      SetConsoleTextAttribute(hStdout, Colour);                    
  124.      coord.X = X;                                                    //  Выбираем позицию
  125.      coord.Y = Y;                                                    //  Выбираем строку
  126.      SetConsoleCursorPosition(hStdout, coord);     
  127.      
  128.      WriteConsole(hStdout, Rus(str), strlen(str), &result, 0);
  129. }
  130.  
  131.  
  132. /*                какой цвет как обозначается:
  133.    (HEX)   
  134. 0   0 = черный
  135. 1   1 = синий
  136. 2   2 = зеленый
  137. 3   3 = голубой
  138. 4   4 = красный
  139. 5   5 = лиловый
  140. 6   6 = желтый
  141. 7   7 = белый
  142. 8   8 = серый
  143. 9   9 = светло-синий
  144. 10  a = светло-зеленый
  145. 11  b = светло-голубой
  146. 12  c = светло-красный
  147. 13  d = светло-лиловый
  148. 14  e = светло-желтый
  149. 15  f = ярко-белый
  150. */
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188. /*
  189.  
  190.  
  191.  
  192. #include <string.h>
  193. #include <stdio.h>
  194. #include <stdlib.h>
  195. #include <iostream>
  196. #pragma warning(disable : 4996)
  197. using namespace std;
  198. char sc[15];
  199. int ind = 0;
  200. int main() {
  201.     int s = 0;
  202.     while (true) {
  203.         printf("enter coordinactions of 2 cells : ");
  204.         scanf("%s", sc);
  205.        
  206.         if(0 == strcmp(sc, "end") ) break;
  207.  
  208.         for (int i = 1; i < 3; i++) {
  209.             printf("%dst is ", i);
  210.             if (sc[ind] == '-') ind++;
  211.             if (sc[ind] % 2 == 1 && sc[ind + 1] % 2 == 1) {
  212.                 printf("black");
  213.                 s += -10;
  214.             }
  215.             else if (sc[ind] % 2 == 0 && sc[ind + 1] % 2 == 1) {
  216.                 printf("white");
  217.                 s += 10;
  218.             }
  219.             else if (sc[ind] % 2 == 0 && sc[ind + 1] % 2 == 0) {
  220.                 printf("black");
  221.                 s += -10;
  222.             }
  223.             else if (sc[ind] % 2 == 1 && sc[ind + 1] % 2 == 0) {
  224.                 printf("white");
  225.                 s += 10;
  226.             }
  227.             printf("\n");
  228.             if (i == 2 && abs(s) == 20) {
  229.                 printf("Yes, the colors are the same!\n\a");
  230.             }
  231.             else if(i == 2) {
  232.                 printf("No, the colors arent the same!\n\a");
  233.             }
  234.             ind += 2;
  235.         }
  236.     }
  237. }
  238.  
  239.  
  240.  
  241.  
  242. */
  243.  
  244.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement