简体   繁体   English

C ++报错

[英]C++ gives an error

Hello I have an error at this program that is wcout is not a member of `std'. 您好,我在此程序中遇到错误,该错误是wcout不是`std'的成员。 Also I used iostream as you see but didnt work.I have Dev-C++ 4.9.9.2 and my operating system is XP SP3 I need your help. 如您所见,我也使用了iostream但没有用。我有Dev-C ++ 4.9.9.2,我的操作系统是XP SP3,需要您的帮助。 Thanks for free time. 感谢您的空闲时间。

#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;
}

If you're compiling with MinGW, wide characters are not yet supported . 如果使用MinGW进行编译, 则尚不支持宽字符 If you really need it, an alternative is to use the STLPort library as an alternative to libstdc++. 如果确实需要它,一种替代方法是使用STLPort库替代libstdc ++。

Dev-C++ 4.9.9.2 that you're using comes with MinGW-gcc 3.4.2 which is 7+ years old , likely doesn't have wide-chars properly supported as suggested by sftrabbit. 您使用的Dev-C ++ 4.9.9.2随附7年前的 MinGW-gcc 3.4.2,可能没有sftrabbit建议的宽字符正确支持。

If you look at the top of the original Dev-C++ at sourceforge you'll see that its been superseded by Orwell Dev-C++ . 如果您在sourceforge上查看原始Dev-C ++的顶部,您会发现它已被Orwell Dev-C ++取代。 I would suggest using that if you need wide-char support since it packages a much more recent version of MinGW-gcc. 如果您需要宽字符支持,我建议您使用它,因为它可以打包最新版本的MinGW-gcc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM