Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <conio.h>
  7. #include <cmath>
  8. #include <windows.h>
  9. #include <ctime>
  10. #include <string>
  11. #include <dos.h>
  12. #include <dir.h>
  13. #include <fstream>
  14. #include <math.h>
  15. #include <time.h>
  16. #include <ctype.h>
  17. using namespace std;
  18.  
  19. void gotoxy(int x, int y)
  20. {
  21. COORD c;
  22. c.X = x-1;
  23. c.Y = y-1;
  24.  
  25. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);
  26. }
  27. int main()
  28. {
  29. string txt;
  30. char corner;
  31. char border;
  32. HANDLE hOut;
  33.  
  34. hOut = GetStdHandle( STD_OUTPUT_HANDLE );
  35.  
  36. cout<<"TEKST: ";
  37. cin>>txt;
  38. cout<<"ROG: ";
  39. cin>>corner;
  40. cout<<"RAMKA: ";
  41. cin>>border;
  42.  
  43.  
  44.  
  45. int kolor_napis;
  46. cout<<"JAKI KOLOR NAPISU: "<<endl;
  47. cout<<"1. CZERWONY"<<endl;
  48. cout<<"2. NIEBIESKI"<<endl;
  49. cout<<"3. ZIELONY"<<endl;
  50.  
  51. cout<<"CYFRA: ";
  52. cin>>kolor_napis;
  53.  
  54. int kolor_ramka;
  55. cout<<"JAKI KOLOR RAMKI : "<<endl;
  56. cout<<"1. CZERWONY"<<endl;
  57. cout<<"2. NIEBIESKI"<<endl;
  58. cout<<"3. ZIELONY"<<endl;
  59.  
  60.  
  61. cout<<"CYFRA : ";
  62. cin>>kolor_ramka;
  63.  
  64.  
  65. system ("cls");
  66.  
  67.  
  68.  
  69. gotoxy (1, 1 );
  70. cout<<"x";
  71. gotoxy (120, 1);
  72. cout<<"x";
  73. int i = 1;
  74. while (i<30)
  75. {
  76. gotoxy((i*4),(1+i));
  77. cout<<border;
  78.  
  79. gotoxy((120-(i*4)),(1+i));
  80. cout<<border;
  81.  
  82. i++;
  83. }
  84.  
  85.  
  86.  
  87.  
  88. switch(kolor_napis)
  89. {
  90. case 1:
  91. SetConsoleTextAttribute( hOut, FOREGROUND_RED );
  92. break;
  93. case 2:
  94. SetConsoleTextAttribute( hOut, FOREGROUND_BLUE );
  95. break;
  96. case 3:
  97. SetConsoleTextAttribute( hOut, FOREGROUND_GREEN );
  98. break;
  99.  
  100. }
  101.  
  102. int dlugosc=txt.length();
  103. gotoxy((60-dlugosc/2), 16);
  104. cout<<txt;
  105.  
  106.  
  107. switch(kolor_ramka)
  108. {
  109. case 1:
  110. SetConsoleTextAttribute( hOut, FOREGROUND_RED );
  111. break;
  112. case 2:
  113. SetConsoleTextAttribute( hOut, FOREGROUND_BLUE );
  114. break;
  115. case 3:
  116. SetConsoleTextAttribute( hOut, FOREGROUND_GREEN );
  117. break;
  118. }
  119.  
  120. gotoxy(1,1);
  121. cout<<corner;
  122. gotoxy(120,1);
  123. cout<<corner;
  124. gotoxy(1,30);
  125. cout<<corner;
  126. gotoxy(120,30);
  127. cout<<corner;
  128. int z=0;
  129. while(z<118)
  130. {
  131. gotoxy(2+z,1);
  132. cout<<border;
  133. gotoxy(2+z,30);
  134. cout<<border;
  135. z++;
  136. }
  137. int p=0;
  138. while(p<28)
  139. {
  140. gotoxy(1,2+p);
  141. cout<<border;
  142. gotoxy(120,2+p);
  143. cout<<border;
  144. p++;
  145. }
  146.  
  147.  
  148. getch();
  149. return 0;
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement