Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4. #include <conio.h>
  5. #include <stdlib.h>
  6. #include <cstdlib>
  7. #include <dos.h>
  8. #include <windows.h>
  9. #include <time.h>
  10. #include <unistd.h>
  11. #include <cstdio>
  12.  
  13. using namespace std;
  14. int wybor;
  15. void zmiana();
  16. void wypisanie();
  17. void ile();
  18. void szukaj();
  19. void zamien();
  20. void szyk();
  21.  
  22. void moja_funkcja()
  23. {
  24. cout << "[1] - Zmiana tekstu na duże litery" << endl;
  25. cout << "[2] - Wypisanie tekstu TheBest" << endl;
  26. cout << "[3] - Ile slow jest w zdaniu" << endl;
  27. cout << "[4] - Szukaj znaku" << endl;
  28. cout << "[5] - Zamiana znaku" << endl;
  29. cout << "[6] - Zmiana szyku w zdaniu" << endl;
  30. wybor=getch();
  31.  
  32. if(wybor=='1')
  33. {
  34. zmiana();
  35. }
  36. if(wybor=='2')
  37. {
  38. wypisanie();
  39. }
  40. if(wybor=='3')
  41. {
  42. ile();
  43. }
  44. if(wybor=='4')
  45. {
  46. szukaj();
  47. }
  48. if(wybor=='5')
  49. {
  50. zamien();
  51. }
  52. if(wybor=='6')
  53. {
  54. szyk();
  55. }
  56. }
  57.  
  58. void zmiana()
  59. {
  60.  
  61. system("cls");
  62. string napis;
  63. cout << endl << "Podaj ciag znakow: ";
  64. getline(cin, napis);
  65. cout << endl << "Wpisales: " << napis;
  66. cout << endl << "Dlugosc: " << napis.size();
  67. cout << endl << "Powiekszony: " ;
  68. int i=0;
  69. char c;
  70. while (napis[i])
  71. {
  72. c=napis[i];
  73. putchar (toupper(c));
  74. i++;
  75. }
  76.  
  77. cout << endl << "Zamieniony: QWEYTR" ;
  78. int n;
  79. cin >> n;
  80. while ( n > 0 ) {
  81. i = n % 10;
  82. if (i != 0){
  83. n /= 10;
  84. cout << i << endl;
  85. } else
  86. n /= 10;
  87. }
  88. }
  89.  
  90. void wypisanie()
  91. {
  92. system("cls");
  93. system("COLOR FC");
  94. string a;
  95. cout << endl << "Wpisz slowo: ";
  96. getline(cin, a);
  97. int x;
  98. x=a.size();
  99. cout << endl << "Wpisz slowo: " << x << endl;
  100. int b;
  101. for(b=0;b<x;b++)
  102. {
  103. cout << "TheBest";
  104. }
  105. }
  106. void ile()
  107. {
  108. system("cls");
  109. system("COLOR BC");
  110. int z=1;
  111. string napis;
  112. cout << endl << "Podaj ciag znakow: ";
  113. getline(cin, napis);
  114.  
  115. int l=napis.length();
  116.  
  117. for (int i=0; i<l ; i++)
  118. {
  119. if (napis[i]==' ')
  120. z++;
  121. }
  122.  
  123. cout << "Ilosc wyrazow: " << z <<endl;
  124. }
  125.  
  126. void szukaj()
  127. {
  128. cout << "jeszcze nic" << endl;
  129. }
  130.  
  131. void zamien()
  132. {
  133. cout << "jeszcze nic" << endl;
  134. }
  135.  
  136. void szyk()
  137. {
  138. cout << "jeszcze nic" << endl;
  139. }
  140.  
  141. int main()
  142. {
  143. cout << "W programie sa nastepujace opcje:" << endl;
  144. moja_funkcja();
  145.  
  146. getch();
  147. return 0;
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement