When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
116 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
What terminal are you using and is it set to use UTF-8 or ASCII? (You need the former)
I have no idea how to check? If you are asking OS im on windows
okay then it's powershell or cmd
its cmd
take a screenshot
can you show your code?
int main() {
int input;
int input2;
std::cout << "Yüzde hesaplayıcısına hoşgeldin, bir değer gir: ";
std::cin >> input;
std::cout << "\nBaşka bir değer gir: ";
std::cin >> input2;
double yuzdesonuc = input / (double)input2 * 100;
std::cout << input << "/" << input2 << " = " << yuzdesonuc << "%";
}
did you set utf-8 in your cmd preferences?
right click on cmd
windows
should I change system locale or add chcp 65001?
wait I'll see in mine once
problem is with encoding in compiler i think
not preferences...it's properties
cause i am able to write those problematic characters in the input section of my code
they display with no problem
compiler fucks with the characters idk how
oh
it's not the compiler lol
then wot
terminal
how to solve it then
instead put those sentences in variables
big L from c++
yeah
Severity Code Description Project File Line Suppression State Details
Error (active) E0415 no suitable constructor exists to convert from "const char [56]" to "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>" learningcpp C:\Users\admin\source\repos\learningcpp\learningcpp\main.cpp 10
yes
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
use it in this way
there is just Y in the console rn
show
use wcout
int main() {
int input;
int input2;
std::wstring sentence1 = L"Yüzde hesaplayıcısına hoşgeldin, bir değer gir: ";
std::wstring sentence2 = L"\nBaşka bir değer gir: ";
std::wcout << sentence1;
std::cin >> input;
std::wcout << sentence2;
std::cin >> input2;
double yuzdesonuc = input / (double)input2 * 100;
std::cout << input << "/" << input2 << " = " << yuzdesonuc << "%";
}
wcin
it won't matter the problem starts in the first wcout
wait I'll try
;compile -includeiostream -includestring -Wall -Wextra
Y?zde hesaplay?c?s?na ho?geldin, bir de?er gir:
Ba?ka bir de?er gir:
this

I think the problem is with the cmd itself though.
Just because you can input them and they show correct I don't think means that they can also be outputted.
Just try to apply the change Yedco suggested and see if it works
alr
now the special characters just vanished
progress I guess
The code works, the problem is Windows:
https://godbolt.org/z/7Ms6bnKxd
how do they get the same input then it must be about msvc?
It is using GCC + UTF8 to display text.
I still don't get what is the problem, my cmd is set to utf8 i compile with msvc
utf8 part looks the same
In a Cygwin terminal in Windows it works as expected.
so the problem is windows terminal?
yep
any fix or it is what it is?
or MSVC
I used GCC to compile it.
I will try with GCC + Windows terminal
Is the Windows terminal
Compiling with GCC or MSVC works in the Cygwin terminal
F the windows terminal
use powershell
can I direct cout to powershell?
powershell terminal also doesn't work
oh
so is there any way to fix windows terminal or should I change it.
and still how can I write those special characters and display them but not output them
Probably the best option is to use a library for a better terminal.
any recommendation?
or something more simple that supports UTF8
This also works to make the Windows Terminal display unicode: https://stackoverflow.com/questions/2849010/output-unicode-to-console-using-c-in-windows#:~:text=There are three things you have to do,a subset of that called Lucida Console.
I get this error when I add _setmode
@fading sundial
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
is lucida console included in windows or do I have to download it cause I don't see it in fonts section maybe my windows lacks sum features
It should be included
The Consolas font also works.
Probably any font with Unicode and fixed size support should do it,
Just wanted to say fuck character encoding lol
its already using consolas
I was wrong, there is a way to make it work in Windows terminal only using code: