问题标题: 怎么错了 1236

0
0
已解决
黄瀚霆
黄瀚霆
初级光能
初级光能

http://judge.codingtang.com/problem/1666/

#include<iostream>
using namespace std;
int main()
{
    char a;
    cin>>a;
    if(a='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','q','w','e','r','t','y','u','i','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m')
    cout<<int(a);
    else
    cout<<a;
    return 0;
}

 


0
已采纳
郑怡翔
郑怡翔
初级天翼
初级天翼
if(a='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','q','w','e','r','t','y','u','i','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m')
    cout<<int(a);

这句话错了

应该用||或运算符而且不是赋值,是等于(==):

if(a=='A'||a=='B'||a=='C'||a=='D'||a=='E'||a=='F'||a=='G'||a=='H'||a=='I'||a=='J'||a=='K'||a=='L'||a=='M'||a=='N'||a=='O'||a=='P'||a=='Q'||a=='R'||a=='S'||a=='T'||a=='U'||a=='V'||a=='W'||a=='X'||a=='Y'||a=='Z'||a=='q'||a=='w'||a=='e'||a=='r'||a=='t'||a=='y'||a=='u'||a=='i'||a=='o'||a=='p'||a=='a'||a=='s'||a=='d'||a=='f'||a=='g'||a=='h'||a=='j'||a=='k'||a=='l'||a=='z'||a=='x'||a=='c'||a=='v'||a=='b'||a=='n'||a=='m')
    cout<<int(a);

 

0
翟谦瑞
翟谦瑞
新手守护
新手守护
if(a='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','q','w','e','r','t','y','u','i','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m')

错了,应用

if(a<='z'&&a>='a'||a<='Z'&&a>='A')

 

0
陶梓锐
陶梓锐
新手光能
新手光能

if(a='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','q','w','e','r','t','y','u','i','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m')

错了

0
0
我要回答