printf中文输出成乱码,求帮助!!!

 代码如下,运行后如输入有英文有中文(如输入abc一二三)输出是abc���,英文部分输出正常(abc),中文部分输出不正常(���),全是乱码,输入全是英文,输出正常,输入全是中文,输出全是乱码,求帮助!!!
 

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string input(string Input){
	string Output;
	cout<<Input<<"\n";
	cin>>Output;
	return Output;
}
int main(){
	string Input="???";
	string Output=input(Input);
	printf_s(Output.c_str());
	return 0;
}

VScold1.94.2

gcc.exe (Rev3, Built by MSYS2 project) 14.1.0

g++.exe (Rev3, Built by MSYS2 project) 14.1.0

GNU gdb (GDB) 15.1

win11

C17

C++17

c_cpp_properties.json如下

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:/msys64/ucrt64/bin/gcc.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}

 launch.json如下

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [


    
    {
        "name": "(gdb) 启动",
        "type": "cppdbg",
        "request": "launch",
        "program": "输入程序名称,例如 ${workspaceFolder}/a.exe",
        //"program": "${fileDirname}:\\program.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "/path/to/gdb",
        //"miDebuggerPath": "D:\\msys64\\mingw64\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "为 gdb 启用整齐打印",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "将反汇编风格设置为 Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
    }
    ]
}

settings.json如下

{
    "files.associations": {
        "iostream": "cpp",
        "string": "cpp",
        "*.tcc": "cpp"
    }
}

tasks.json如下

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "D:\\msys64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                //"*.c",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
                //"${fileDirname}\\program.exe"
                //"${workspaceFolder}\\${workspaceRootFolderName}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值