[ create a new paste ] login | about

Link: http://codepad.org/YoB3dM1r    [ raw code | output | fork ]

C++, pasted on Jun 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "stdio.h"
#include "stdlib.h"

int main()
{
    char s[] = "123ss456w7";
    int nShow = 1;
    for (int i = 0; i < (int)strlen(s); i++)
    {
        if (s[i] >= '0' && s[i] <= '9')
        {
            printf("%c", s[i]);
            nShow = 1;
        }
        else
        {
            if (nShow) printf("\n");
            nShow = 0;
        }
    }
}


Output:
1
2
3
123
456
7


Create a new paste based on this one


Comments: