Другое С/С++ Вопрос - Ответ

chebocsar

Потрачен
6
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
почему русские символы каверкаются? локализация подключена в чем тогда проблема , никак не пойму(visual studio)
Код:
#include <iostream>
#include<locale>
using namespace std;

void passportIndentification()
{

setlocale(LC_ALL, "rus");

int age;

string name;
cout << "Введите свое имя" << endl;
cin >> name;
string surname;
cout << "Введите свою фамилию" << endl;
cin >> surname;
cout << "Введите свой возвраст" << endl;
cin >> age;
string nation;
cout << "Введите свою нацию" << endl;
cin >> nation;
string from;
cout << "Введите свою страну" << endl;
cin >> from;
string town;
cout << "Введите свой город" << endl;
cin >> town;


cout << "Ваше имя: " << name << endl;
cout << "Ваша фамилия: " << surname << endl;
cout << "Ваш возвраст: " << age << endl;
cout << "Ваша нация: " << nation << endl;
cout << "Ваша страна: " << from << endl;
cout << "Ваш город: " << town << endl;

}
int main() {
passportIndentification();

return 0;
}
 

moreveal

Известный
Проверенный
852
525
почему русские символы каверкаются? локализация подключена в чем тогда проблема , никак не пойму(visual studio)
Код:
#include <iostream>
#include<locale>
using namespace std;

void passportIndentification()
{

setlocale(LC_ALL, "rus");

int age;

string name;
cout << "Введите свое имя" << endl;
cin >> name;
string surname;
cout << "Введите свою фамилию" << endl;
cin >> surname;
cout << "Введите свой возвраст" << endl;
cin >> age;
string nation;
cout << "Введите свою нацию" << endl;
cin >> nation;
string from;
cout << "Введите свою страну" << endl;
cin >> from;
string town;
cout << "Введите свой город" << endl;
cin >> town;


cout << "Ваше имя: " << name << endl;
cout << "Ваша фамилия: " << surname << endl;
cout << "Ваш возвраст: " << age << endl;
cout << "Ваша нация: " << nation << endl;
cout << "Ваша страна: " << from << endl;
cout << "Ваш город: " << town << endl;

}
int main() {
passportIndentification();

return 0;
}
с консолью трабл скорее, пробуй что-нибудь отсюда
 

skrrt

Активный
245
89
почему русские символы каверкаются? локализация подключена в чем тогда проблема , никак не пойму(visual studio)
Код:
#include <iostream>
#include<locale>
using namespace std;

void passportIndentification()
{

setlocale(LC_ALL, "rus");

int age;

string name;
cout << "Введите свое имя" << endl;
cin >> name;
string surname;
cout << "Введите свою фамилию" << endl;
cin >> surname;
cout << "Введите свой возвраст" << endl;
cin >> age;
string nation;
cout << "Введите свою нацию" << endl;
cin >> nation;
string from;
cout << "Введите свою страну" << endl;
cin >> from;
string town;
cout << "Введите свой город" << endl;
cin >> town;


cout << "Ваше имя: " << name << endl;
cout << "Ваша фамилия: " << surname << endl;
cout << "Ваш возвраст: " << age << endl;
cout << "Ваша нация: " << nation << endl;
cout << "Ваша страна: " << from << endl;
cout << "Ваш город: " << town << endl;

}
int main() {
passportIndentification();

return 0;
}
с локализацией все хорошо, попробуй другую консоль
 

cheboxarov.coding

Новичок
13
17
почему русские символы каверкаются? локализация подключена в чем тогда проблема , никак не пойму(visual studio)
Код:
#include <iostream>
#include<locale>
using namespace std;

void passportIndentification()
{

setlocale(LC_ALL, "rus");

int age;

string name;
cout << "Введите свое имя" << endl;
cin >> name;
string surname;
cout << "Введите свою фамилию" << endl;
cin >> surname;
cout << "Введите свой возвраст" << endl;
cin >> age;
string nation;
cout << "Введите свою нацию" << endl;
cin >> nation;
string from;
cout << "Введите свою страну" << endl;
cin >> from;
string town;
cout << "Введите свой город" << endl;
cin >> town;


cout << "Ваше имя: " << name << endl;
cout << "Ваша фамилия: " << surname << endl;
cout << "Ваш возвраст: " << age << endl;
cout << "Ваша нация: " << nation << endl;
cout << "Ваша страна: " << from << endl;
cout << "Ваш город: " << town << endl;

}
int main() {
passportIndentification();

return 0;
}
Код:
#include <iostream>
#include<locale>
#include <io.h>
#include <fcntl.h>

using namespace std;

void passportIndentification()
{

    _setmode(_fileno(stdin), _O_U16TEXT);
    _setmode(_fileno(stdout), _O_U16TEXT);
    setlocale(LC_ALL, "rus");

    int age;

    wstring name;
    wcout << L"Введите свое имя" << endl;
    wcin >> name;

    wstring surname;
    wcout << L"Введите свою фамилию" << endl;
    wcin >> surname;

    wcout << L"Введите свой возвраст" << endl;
    wcin >> age;
    wstring nation;
    wcout << L"Введите свою нацию" << endl;
    wcin >> nation;
    wstring from;
    wcout << L"Введите свою страну" << endl;
    wcin >> from;
    wstring town;
    wcout << L"Введите свой город" << endl;
    wcin >> town;


    wcout << L"Ваше имя: " << name << endl;
    wcout << L"Ваша фамилия: " << surname << endl;
    wcout << L"Ваш возвраст: " << age << endl;
    wcout << L"Ваша нация: " << nation << endl;
    wcout << L"Ваша страна: " << from << endl;
    wcout << L"Ваш город: " << town << endl;

}
int main() {
passportIndentification();

return 0;
}
 
  • Эм
Реакции: Z3roKwq

why ega

РП игрок
Модератор
2,541
2,233
Хочу подключить memwrapper в свой проект CMake, для этого использую что-то вроде такого:
Код:
FetchContent_Declare(
    memwrapper
    GIT_REPOSITORY https://github.com/The-Musaigen/memwrapper.git
    GIT_TAG 7d51e3134d8f955651ef7dda8bab44b0efb0665f
)

FetchContent_MakeAvailable("memwrapper")


add_library("memwrapper" INTERFACE)


target_include_directories(${PROJECT_NAME} PUBLIC ${memwrapper_SOURCE_DIR})
Все работало стабильно до того, пока не убрал kthook из проекта: начало выдавать заранее предусмотренную ошибку only c++17 and newer. Исправил это, добавив настройку стандарта:
Makefile:
set_target_properties(${PROJECT_NAME} PROPERTIES
    CXX_STANDARD "17"
    CXX_STANDARD_REQUIRED ON
    SUFFIX ".asi"
)
Но теперь появляется ошибки в самом memwrapper:
1708594832900.png
 

cheboxarov.coding

Новичок
13
17
Хочу подключить memwrapper в свой проект CMake, для этого использую что-то вроде такого:
Код:
FetchContent_Declare(
    memwrapper
    GIT_REPOSITORY https://github.com/The-Musaigen/memwrapper.git
    GIT_TAG 7d51e3134d8f955651ef7dda8bab44b0efb0665f
)

FetchContent_MakeAvailable("memwrapper")


add_library("memwrapper" INTERFACE)


target_include_directories(${PROJECT_NAME} PUBLIC ${memwrapper_SOURCE_DIR})
Все работало стабильно до того, пока не убрал kthook из проекта: начало выдавать заранее предусмотренную ошибку only c++17 and newer. Исправил это, добавив настройку стандарта:
Makefile:
set_target_properties(${PROJECT_NAME} PROPERTIES
    CXX_STANDARD "17"
    CXX_STANDARD_REQUIRED ON
    SUFFIX ".asi"
)
Но теперь появляется ошибки в самом memwrapper:
какой стандарт используешь? и как подключаешь заголовочные файлы?