P1597 语句解析

题目如下:

 思路:

也就给三个abc赋值

用数组即可

代码如下:

#include<cstdio>
#include<iostream>
using namespace std;
int main(){
    char s1,s2;
    int m[3]={0};
    while(scanf("%c:=%c;",&s1,&s2)==2)
    { if(s2>='a'&&s2<='z')
        m[s1-'a']=m[s2-'a'];
      if(s2>='0'&&s2<='9')
        m[s1-'a']=s2-'0';
    }
    cout<<m[0]<<" "<<m[1]<<" "<<m[2]<<endl;
    return 0;
}     
无聊就学习 反正没事干
原文地址:https://www.cnblogs.com/miao-xixixi/p/12955768.html