Yes, many. Which ones not possible to say. Probably a mix.Zach Wegner wrote:Do you have an explanation for the specific similarities I pointed out?
Do you have an explanation for the 72% of differences?
Moderator: Ras
Yes, many. Which ones not possible to say. Probably a mix.Zach Wegner wrote:Do you have an explanation for the specific similarities I pointed out?
I counted 28% similar. That means 72% different.Zach Wegner wrote:72% is quite a stretch. In fact in the post in question I noted the differences. There are very few. Each one of them are about as trivial as changing a variable name, so I fail to see your point.
And I really would like an explanation why comparing an int value with a float 0.0 is the "utterly obvious" way to write code.
OK:Uri Blass wrote:I could run it from the command line by start->programs->accessories->command prompt.bob wrote:string.h should be included. I get no errors from ICC when compiling without it and did notice. The only risk is that the compiler assumes I am using strcmp() properly (which I am) so I might miss an important warning.
argc is the number of command line arguments +1.
argv[0] is a pointer to a string containing the name of the executable you are running.
argv[1] is a pointer to the first argument.
argv[2] same for second.
argc would be 4 since there are four total arguments, counting the name of the executable...
to run it, you just type "calc one + two" if you called the executable "calc".
It runs on my linux laptop with no problem.
Your code does not do exactly the task that it is asked.
The task is to translate one plus two to 3 when you translate one + two to 3.
Uri
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *words[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
int i, answer, operand1, operand2;
for (i=0; i<10; i++) {
if (!strcmp(argv[1], words[i])) operand1 = i;
if (!strcmp(argv[3], words[i])) operand2 = i;
}
if (!strcmp(argv[2], "plus")) answer = operand1 + operand2;
if (!strcmp(argv[2], "minus")) answer = operand1 - operand2;
if (!strcmp(argv[2], "times")) answer = operand1 * operand2;
if (answer < 10)
printf("%s\n",words[answer]);
else
printf("answer is > 9, no output produced\n");
}
Zach, please don't waste your energy.Zach Wegner wrote:that's what I thought...
kranium wrote:Zach, please don't waste your energy.Zach Wegner wrote:that's what I thought...
The onus is on Vas to respond to the questions that were posed to him long ago. Chrisw and Graham are constantly turning this around...
proclaiming that what we already presented is not good enough, (i.e. he doesn't need to respond?) and we must produce more 'evidence'.
but unfortunatey this forum != trial, and moderator and tester != judge
Yes it worksbob wrote:OK:Uri Blass wrote:I could run it from the command line by start->programs->accessories->command prompt.bob wrote:string.h should be included. I get no errors from ICC when compiling without it and did notice. The only risk is that the compiler assumes I am using strcmp() properly (which I am) so I might miss an important warning.
argc is the number of command line arguments +1.
argv[0] is a pointer to a string containing the name of the executable you are running.
argv[1] is a pointer to the first argument.
argv[2] same for second.
argc would be 4 since there are four total arguments, counting the name of the executable...
to run it, you just type "calc one + two" if you called the executable "calc".
It runs on my linux laptop with no problem.
Your code does not do exactly the task that it is asked.
The task is to translate one plus two to 3 when you translate one + two to 3.
Uri
That work for you?Code: Select all
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char *words[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; int i, answer, operand1, operand2; for (i=0; i<10; i++) { if (!strcmp(argv[1], words[i])) operand1 = i; if (!strcmp(argv[3], words[i])) operand2 = i; } if (!strcmp(argv[2], "plus")) answer = operand1 + operand2; if (!strcmp(argv[2], "minus")) answer = operand1 - operand2; if (!strcmp(argv[2], "times")) answer = operand1 * operand2; if (answer < 10) printf("%s\n",words[answer]); else printf("answer is > 9, no output produced\n"); }
output:
scrappy% ./xpr five plus three
eight
scrappy% ./xpr seven minus five
two
scrappy% ./xpr three times two
six
chrisw wrote:What's the point to compare the code of someone so biased he won't even accept to make a statement that Rybka3 is under no threat in Beijing?
How would anyone imagine you can participate in this experiment? Of course you'll produce code as different as it is possible to get.
Can you spell bias? Bob?
chrisw wrote:ROTFL!!
You can't participate in an experiment about writing code to see similarities/differences when you've already seen the first piece of code, Bob.
Can you spell bias?
Can you parse "experimenter affecting his own results"?
It's now a thought experiment. Can you spell Einstein?
Can you spell science?