Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 有语法错误,但我没有找到?_C++ - Fatal编程技术网

C++ 有语法错误,但我没有找到?

C++ 有语法错误,但我没有找到?,c++,C++,||==生成文件:无项目编译器中无目标:未知===| \Baconian密码.cpp | |在函数“int main”中:| BaCONION密码.CPP 25错误:ISO C++禁止指针和整数之间的比较[fPrime] BaCONION密码.CPP 49错误:ISO C++禁止指针和整数之间的比较[fPrime] BaCONION密码.CPP 91错误:ISO C++禁止指针和整数之间的比较[fPrime] ||==生成失败:3个错误,0个警告0分5秒===| 在C++中,P>},代表完全不同

||==生成文件:无项目编译器中无目标:未知===| \Baconian密码.cpp | |在函数“int main”中:| BaCONION密码.CPP 25错误:ISO C++禁止指针和整数之间的比较[fPrime] BaCONION密码.CPP 49错误:ISO C++禁止指针和整数之间的比较[fPrime] BaCONION密码.CPP 91错误:ISO C++禁止指针和整数之间的比较[fPrime] ||==生成失败:3个错误,0个警告0分5秒===|

在C++中,P>}

,代表完全不同的事物。

这是单个字符:

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
char a[27]=      {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' '};
char A[27]= {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' '};
string U[27]= {"AAAAA","AAAAB","AAABA","AAABB","AABAA","AABAB","AABBA","AABBB","ABAAA","ABAAB","ABABA","ABABB","ABBAA","ABBAB","ABBBA","ABBBB","BAAAA","BAAAB","BAABA","BAABB","BABAA","BABAB","BABBA","BABBB","BBAAA","BBAAB"," "};
char choiceNum;
while (true)
    {
cout<<"Choose what do you want to do  today"<<endl<<"1-cipher "<<endl<<"2-decipher"<<endl<<"3-If you End what you want"<<endl;
cin>>choiceNum;
cin.ignore();
string message, newMessage, message2;
int i,k, j ;
if (choiceNum=="1")
{
    cout<<"Enter your message to cipher ya man-.-"<<endl;


        newMessage="";
        getline(cin,message);

        for(i=0 ; i<message.length() ; i++)

        {
            for (j=0 ; j<27 ; j++)
            {
                if (message[i]==a[j]|| message[i]==A[j] )
                {
                    newMessage=newMessage+U[j];
                }

            }
        }
        cout<<newMessage<<endl;
    }


if (choiceNum=="2")
{
    cout<<"Enter your message to decipher ya man-.- :"<<endl;


        newMessage="";
        message2="";
        getline(cin,message);
        for(i=0 ; i<message.length() ; ++i)
        {
            if (message[i]=='a' || message[i]=='A')
            {
                message[i]='A';
            }
            else if (message[i]=='b' || message[i]=='B')
            {
                message[i]='B';
            }


        }

        for(k=0 ; k<message.length() ; ++k)
        {
            message2=message2+message[k];

            for (j=0 ; j<27 ; ++j)
            {

                if (message2==U[j])
                {

                    newMessage=newMessage+A[j];
                    message2="";
                }
            }
        }


        cout<<newMessage<<endl;

}
if (choiceNum=="3")
        {
            cout<<"End";
            break;
        }

          }



return 0;
这是一个常量字符*字符串:


你不能用==比较像x这样的东西和字符,但你可以比较与“x”。

如果choiceNum==1->如果choiceNum=='1',等等。离题:你的变量名应该比大小写不同。例如,将数组名称更改为小写字母和大写字母,而不是a和a。另请参见:toupper、tolower、isalpha和isdigit函数。
'x'
"x"