[ create a new paste ] login | about

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

C++, pasted on Jun 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string.h>
using namespace std;
void fun(char *s, char t[])
{
    int j = 0;
    for (unsigned int i = 0; i < strlen(s); i++)
    {
        if (i % 2 == 1 && ((int)s[i] % 2 == 1)) continue;
        t[j++] = s[i];
    }
    t[j] = '\0';
}
int main()
{
    char s[] = "hello world!";
    char t[100];
    fun(s, t);
    cout << t << endl;
}


Output:
1
hllo wrld


Create a new paste based on this one


Comments: