Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale>
- #include <windows.h>
- using namespace std;
- char* UpperW1251(char* source, char* destination, int arr_length){
- //int code = (int)('9'); // a=97 z=122 0=48 9=57; //а=-32 я=-1
- for (int i = 0; i < arr_length; i++){
- if (*source == '\0'){
- *destination = *source;
- break;
- }
- else{
- if ((int)*source == -72){
- *destination = (int)*source - 16;
- }
- else if (((int)*source >= 97 && (int)*source <= 122) || ((int)*source >= -32 && (int)*source <= -1)){
- *destination = (int)*source - 32;
- }
- else
- *destination = *source;
- }
- source++;
- destination++;
- }
- return destination;
- }
- int main(int argc, char* argv[])
- {
- setlocale(LC_ALL, "");
- char source[] = "I'm ebal всех в рот, сука ёбаная!!!";
- int source_length = sizeof(source);
- char *pSource = source, *destination = new char[source_length];
- char *pDestination = destination;
- cout << "Исходная строка: ";
- for (int i = 0; i < source_length; i++){
- cout << *pSource;
- pSource++;
- }
- cout << endl;
- pSource = source;
- pDestination = UpperW1251(pSource, pDestination, source_length);
- pDestination = destination;
- cout << "Изменённая строка: ";
- for (int i = 0; i < source_length; i++){
- cout << *pDestination;
- pDestination++;
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement