I will post some challenges here and try to answer them as quickly as possible ;)
Printable View
I will post some challenges here and try to answer them as quickly as possible ;)
Write a function checkeven that take in two parameters: an array call numarray containing integers and its size. The function should return the number of even integers in the array. You should initialise some values into the array numarray. Good luck guys!
Translation: This is a thinly disguised 'do my homework' post.
Quzah.
>I will post some challenges here and try to answer them as quickly as possible ;)
That's a pretty lame attempt. We've seen just about every trick in the book to get other people to do your homework, and this one doesn't even rank in the top ten. It's not even as amusing as the people who pretend to be teachers. I can't give you a very good grade for this.
Your grade:
F
Even if this was actually a challenge you were trying to give us. Most of the people here are programmers for a living. Do you really think this program is a challenge for them? This isn't a challenge for a first year Computer Science student. Please, take this sad attempt for a post to another forum.Quote:
Originally Posted by agentomen
> Translation: This is a thinly disguised 'do my homework' post.
Another translation - post wacky obfuscated answers which the OP can't possibly hand in as their homework assignment, but which are fun non the less :)
Code:#include <stdio.h>
int checkeven ( int *numarray, int size ) {
int j, p = 0, m = ~(~0<<1), c = size;
while ( p < size ) {
unsigned int v = 0, w, x;
for ( j = 0 ; j < 32 && p < size ; j++, p++ ) {
v ^= ( *numarray++ & m ) << j;
}
w = v - ((v >> 1) & 0x55555555);
x = (w & 0x33333333) + ((w >> 2) & 0x33333333);
c -= ((((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24);
}
return c;
}
int main ( ) {
int i, test[100];
for ( i = 0 ; i < 100 ; i++ ) test[i] = i;
printf( &"%d even numbers found\n"[0], checkeven(test,i) );
for ( i = 0 ; i < 100 ; i++ ) test[i] = i|1;
printf( &0["%d even numbers found\n"], checkeven(test,i) );
for ( i = 0 ; i < 100 ; i++ ) test[i] = i*2;
printf( "%d even numbers found\n", checkeven(test,i) );
return 0;
}
Haha...
"This program is exquisite, sir! I'm moving you to AP Computer Science 301 tomorrow"
"Ehhh... I don't really think that's a good idea, teacher."
"Nonsense, with your knowledge of programming at your age? You should ace that course easily."
***Quote:
Originally Posted by SlyMaelstrom
"Hey boss"
"oh hey valued employee. So you know our company depends on this big project, so how's it going?"
"About that yeah, seams our corporate firewall is blocking access to internet forums"
"Get out!"
BTW it seams Salem was banned? How did tht happen?
Salem was not banned - otherwise how would he be using his account?
Nice to see you posting though Salem.
out of curiosity, can you give some links of the top ten?