Guest User

Untitled

a guest
Dec 13th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <ctype.h>
  2. #include <stddef.h>
  3. #include <fstream>
  4. #include <iostream>
  5. #include <string>
  6.  
  7. const char* nimRattoren[] = {
  8. "black", "red", "green", "brown",
  9. "blue", "purple", "cyan", "silver",
  10. "gray", "pink", "lime", "yellow",
  11. "lightBlue", "magenta", "orange", "white"
  12. };
  13.  
  14. void sins(const char* donx, size_t a, const char* nim) {
  15. const char* d = donx;
  16. while (*d != '\0') {
  17. if (*d == '%') {
  18. ++d;
  19. if (*d == '%')
  20. std::cout << '%';
  21. else if (*d == 'r')
  22. std::cout << nimRattoren[a];
  23. else if (*d == 'R') {
  24. std::cout << toupper(nimRattoren[a][0]);
  25. std::cout << (nimRattoren[a] + 1);
  26. } else if (*d == 'e')
  27. std::cout << nim;
  28. } else std::cout << *d;
  29. ++d;
  30. }
  31. std::cout << '\n';
  32. }
  33.  
  34. int main(int aMixpalet, char** mixpalet) {
  35. if (aMixpalet <= 1) {
  36. std::cerr << "est e hosi et xir!\n";
  37. return -1;
  38. }
  39. std::string donx, nim;
  40. std::getline(std::cin, donx);
  41. std::ifstream hosi(mixpalet[1]);
  42. for (size_t i = 0; i < 16; ++i) {
  43. std::getline(hosi, nim);
  44. sins(donx.c_str(), i, nim.c_str());
  45. }
  46. }
Add Comment
Please, Sign In to add comment