C++ (gcc), (削除) 176 (削除ここまで) 137(削除) 137 (削除ここまで) 136 bytes
#import<cstdio>
int i;ff(){puts("#import<cstdio>\nf(unsigned x){");for(;printfint i;printf("x-%u?:puts(\"%s\");",i,i++&1?"even":"odd"),i;);puts("}");}
The case when i = 0 comes last.
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing).
Uses -fpermissive flag to suppress errors from defining f without a type
Thanks to Neil for suggesting changing printf to puts.
Borrows from the C (gcc) answer.
C++ (gcc), (削除) 176 (削除ここまで) 137 bytes
#import<cstdio>
int i;f(){puts("#import<cstdio>\nf(unsigned x){");for(;printf("x-%u?:puts(\"%s\");",i,i++&1?"even":"odd"),i;);puts("}");}
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing).
Uses -fpermissive flag to suppress errors from defining f without a type
Thanks to Neil for suggesting changing printf to puts.
Borrows from the C (gcc) answer.
C++ (gcc), (削除) 176 (削除ここまで) (削除) 137 (削除ここまで) 136 bytes
#import<cstdio>
f(){puts("#import<cstdio>\nf(unsigned x){");for(int i;printf("x-%u?:puts(\"%s\");",i,i++&1?"even":"odd"),i;);puts("}");}
The case when i = 0 comes last.
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing).
Uses -fpermissive flag to suppress errors from defining f without a type
Thanks to Neil for suggesting changing printf to puts.
Borrows from the C (gcc) answer.
C++ (gcc), 176(削除) 176 (削除ここまで) 137 bytes
#import<iostream>#import<cstdio>
int64_tint i;maini;f(){printfputs("#import<iostream>\nmain"#import<cstdio>\nf(unsigned x){int64_t x;std::cin>>x;"");do printf;for("if;printf(x==%ld)printf"x-%u?:puts(\"%s\");",i,i&1i++&1?"odd":"even":"odd");while(++i,i;);printf;puts("}");}
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing).
Uses -fpermissive flag to suppress errors from defining f without a type
Thanks to Neil for suggesting changing printf to puts.
Borrows from the C (gcc) answer .
C++ (gcc), 176 bytes
#import<iostream>
int64_t i;main(){printf("#import<iostream>\nmain(){int64_t x;std::cin>>x;");do printf("if(x==%ld)printf(\"%s\");",i,i&1?"odd":"even");while(++i);printf("}");}
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing)
C++ (gcc), (削除) 176 (削除ここまで) 137 bytes
#import<cstdio>
int i;f(){puts("#import<cstdio>\nf(unsigned x){");for(;printf("x-%u?:puts(\"%s\");",i,i++&1?"even":"odd"),i;);puts("}");}
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing).
Uses -fpermissive flag to suppress errors from defining f without a type
Thanks to Neil for suggesting changing printf to puts.
Borrows from the C (gcc) answer .
C++ (gcc), 176 bytes
#import<iostream>
int64_t i;main(){printf("#import<iostream>\nmain(){int64_t x;std::cin>>x;");do printf("if(x==%ld)printf(\"%s\");",i,i&1?"odd":"even");while(++i);printf("}");}
Uses -fwrapv flag for well-defined signed integer overflow wrapping (as opposed to the standard's undefined behaviour when overflowing)