gpt4 book ai didi

C++ 报错

转载 作者:搜寻专家 更新时间:2023-10-31 00:39:58 27 4
gpt4 key购买 nike

你好,我在这个程序中遇到错误,wcout 不是 `std' 的成员。如您所见,我也使用了 iostream,但没有用。我有 Dev-C++ 4.9.9.2,我的操作系统是 XP SP3我需要你的帮助。感谢您的空闲时间。

#include <iostream>
#include <cstring>
#include <cwchar>
using namespace std;
const wchar_t alphabet[] ={'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I',
'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S',
'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '.', ',', ':', ';', ' '};
const int char_num =44;

void cipher(wchar_t word[], int count, int key)
{
int i = 0;
while(i < count) {
int ind = -1;
while(alphabet[++ind] != word[i]) ;
ind += key;
if(ind >= char_num)
ind -= char_num;
word[i] = alphabet[ind];
++i;
}
}

void decipher(wchar_t word[], int count, int key)
{
int i = 0;
while(i < count) {
int ind = -1;
while(alphabet[++ind] != word[i]) ;
ind -= key;
if(ind < 0)
ind += char_num;
word[i] = alphabet[ind];
++i;
}
}

int main()
{
wchar_t text[] = L"ABJT;";
int len = wcslen(text);
std::wcout << text << std::endl;
cipher(text, len, 2);
std::wcout << text << std::endl;
decipher(text, len, 2);
std::wcout << text << std::endl;
return 0;
}

最佳答案

如果您使用 MinGW 进行编译,wide characters are not yet supported .如果您真的需要它,另一种方法是使用 STLPort库作为 libstdc++ 的替代品。

关于C++ 报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15581569/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com