2016-2

/*
2020/4/17
第二遍
*/
#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char str[10000];

void fun(char temp[],int len,int &count)
{
    int i = 0;
    for(i = 0;i<len;i++)
    {
        if(temp[i] == '=')
        {
            break;
        }
    }

    if(i == len)
        printf("%s%d\n",temp,count++);

    else
    {
        int sum = 0;
        int j = 0;
        for(j = i+1;j<len;j++)
        {
            sum = sum*10 + temp[j]-'0';
        }
        count = sum;
        for(j = 0;j<i;j++)
        {
            printf("%c",temp[j]);
        }
        printf("%d\n",count++);
    }
}

int main()
{
    int i,j;
    char temp[50];
    int ci = 0;
    int count  = 0;
    gets(str);
    int len = strlen(str);

    for(i = 0;i<len;)
    {
        if(str[i] == '}') break;

        while(str[i]!='{' && str[i]!=',')
            {

                i++;
            }

        ci = 0;
        for(j = i+1;j<len;j++)
        {

            if(str[j]!=','&& str[j]!='}')
            {
                temp[ci++] = str[j];
            }
            else
            {
                temp[ci] = '\0';
                fun(temp,ci,count);
                i = j;
                break;
            }
        }
    }
    return 0;
}
/*
enum BOOL{true,false};
true0
false1

enum date{JAN=1,FEB,MAR,APR,MAY,JUN,JULY,AUG,SEP,OCT,NOV,DEC,MON=1,TUE,WED,THU,FRI,SAT,SUN,found=1949};
JAN1
FEB2
MAR3
APR4
MAY5
JUN6
JULY7
AUG8
SEP9
OCT10
NOV11
DEC12
MON1
TUE2
WED3
THU4
FRI5
SAT6
SUN7
found1949
*/

发布了117 篇原创文章 · 获赞 71 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_34686440/article/details/105584469
今日推荐